ERC-20
Overview
Max Total Supply
875,256,965.426792730177424565 CHIVA
Holders
48
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 18 Decimals)
Balance
5,834,292.109155091448041679 CHIVAValue
$0.00Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
Chivalry
Compiler Version
v0.8.18+commit.87f61d96
Optimization Enabled:
No with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
/** ░█████╗░██╗░░██╗██╗██╗░░░██╗░█████╗░██╗░░░░░██████╗░██╗░░░██╗████████╗░█████╗░██╗░░██╗███████╗███╗░░██╗ ██╔══██╗██║░░██║██║██║░░░██║██╔══██╗██║░░░░░██╔══██╗╚██╗░██╔╝╚══██╔══╝██╔══██╗██║░██╔╝██╔════╝████╗░██║ ██║░░╚═╝███████║██║╚██╗░██╔╝███████║██║░░░░░██████╔╝░╚████╔╝░░░░██║░░░██║░░██║█████═╝░█████╗░░██╔██╗██║ ██║░░██╗██╔══██║██║░╚████╔╝░██╔══██║██║░░░░░██╔══██╗░░╚██╔╝░░░░░██║░░░██║░░██║██╔═██╗░██╔══╝░░██║╚████║ ╚█████╔╝██║░░██║██║░░╚██╔╝░░██║░░██║███████╗██║░░██║░░░██║░░░░░░██║░░░╚█████╔╝██║░╚██╗███████╗██║░╚███║ ░╚════╝░╚═╝░░╚═╝╚═╝░░░╚═╝░░░╚═╝░░╚═╝╚══════╝╚═╝░░╚═╝░░░╚═╝░░░░░░╚═╝░░░░╚════╝░╚═╝░░╚═╝╚══════╝╚═╝░░╚══╝ http://chivalrytoken.xyz https://t.me/chivalrytoken https://discord.gg/brcJNW8Nhf https://twitter.com/chivalrytoken https://medium.com/chivalrytoken https://github.com/ChivalryToken */ // Sources flattened with hardhat v2.14.0 https://hardhat.org // File @openzeppelin/contracts/utils/[email protected] // SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @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; } } // File @openzeppelin/contracts/access/[email protected] // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; /** * @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() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // File @openzeppelin/contracts/token/ERC20/[email protected] // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); } // File @openzeppelin/contracts/token/ERC20/extensions/[email protected] // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); } // File @openzeppelin/contracts/token/ERC20/[email protected] // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. _balances[to] += amount; } emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; unchecked { // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. _balances[account] += amount; } emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; // Overflow not possible: amount <= accountBalance <= totalSupply. _totalSupply -= amount; } emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens 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 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been 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 _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} } // File @openzeppelin/contracts/utils/introspection/[email protected] // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface 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); } // File @openzeppelin/contracts/token/ERC721/[email protected] // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; /** * @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`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); } // File @openzeppelin/contracts/token/ERC721/extensions/[email protected] // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; /** * @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); } // File @openzeppelin/contracts/token/ERC721/[email protected] // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface 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 `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); } // File @openzeppelin/contracts/utils/[email protected] // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @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 * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } // File @openzeppelin/contracts/utils/introspection/[email protected] // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; /** * @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; } } // File @openzeppelin/contracts/utils/math/[email protected] // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } } // File @openzeppelin/contracts/utils/[email protected] // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @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] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } } // File @openzeppelin/contracts/token/ERC721/[email protected] // OpenZeppelin Contracts (last updated v4.8.2) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; /** * @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: address zero is not a valid owner"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _ownerOf(tokenId); require(owner != address(0), "ERC721: invalid token ID"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { _requireMinted(tokenId); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not token owner or approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { _requireMinted(tokenId); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or 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 the owner of the `tokenId`. Does NOT revert if token doesn't exist */ function _ownerOf(uint256 tokenId) internal view virtual returns (address) { return _owners[tokenId]; } /** * @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 _ownerOf(tokenId) != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { address owner = ERC721.ownerOf(tokenId); return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId, 1); // Check that tokenId was not minted by `_beforeTokenTransfer` hook require(!_exists(tokenId), "ERC721: token already minted"); unchecked { // Will not overflow unless all 2**256 token ids are minted to the same owner. // Given that tokens are minted one by one, it is impossible in practice that // this ever happens. Might change if we allow batch minting. // The ERC fails to describe this case. _balances[to] += 1; } _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId, 1); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * This is an internal function that does not check if the sender is authorized to operate on the token. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId, 1); // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook owner = ERC721.ownerOf(tokenId); // Clear approvals delete _tokenApprovals[tokenId]; unchecked { // Cannot overflow, as that would require more tokens to be burned/transferred // out than the owner initially received through minting and transferring in. _balances[owner] -= 1; } delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId, 1); } /** * @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 from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId, 1); // Check that tokenId was not transferred by `_beforeTokenTransfer` hook require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); // Clear approvals from the previous owner delete _tokenApprovals[tokenId]; unchecked { // `_balances[from]` cannot overflow for the same reason as described in `_burn`: // `from`'s balance is the number of token held, which is at least one before the current // transfer. // `_balances[to]` could overflow in the conditions described in `_mint`. That would require // all 2**256 token ids to be minted, which in practice is impossible. _balances[from] -= 1; _balances[to] += 1; } _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId, 1); } /** * @dev Approve `to` to operate on `tokenId` * * Emits an {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits an {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Reverts if the `tokenId` has not been minted yet. */ function _requireMinted(uint256 tokenId) internal view virtual { require(_exists(tokenId), "ERC721: invalid token ID"); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`. * - When `from` is zero, the tokens will be minted for `to`. * - When `to` is zero, ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * - `batchSize` is non-zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 firstTokenId, uint256 batchSize ) internal virtual {} /** * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`. * - When `from` is zero, the tokens were minted for `to`. * - When `to` is zero, ``from``'s tokens were burned. * - `from` and `to` are never both zero. * - `batchSize` is non-zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 firstTokenId, uint256 batchSize ) internal virtual {} /** * @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override. * * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such * that `ownerOf(tokenId)` is `a`. */ // solhint-disable-next-line func-name-mixedcase function __unsafe_increaseBalance(address account, uint256 amount) internal { _balances[account] += amount; } } // File @openzeppelin/contracts/utils/cryptography/[email protected] // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } } // File @openzeppelin/contracts/utils/structs/[email protected] // OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } } // File @openzeppelin/contracts/utils/structs/[email protected] // OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableMap.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableMap.js. pragma solidity ^0.8.0; /** * @dev Library for managing an enumerable variant of Solidity's * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`] * type. * * Maps have the following properties: * * - Entries are added, removed, and checked for existence in constant time * (O(1)). * - Entries are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableMap for EnumerableMap.UintToAddressMap; * * // Declare a set state variable * EnumerableMap.UintToAddressMap private myMap; * } * ``` * * The following map types are supported: * * - `uint256 -> address` (`UintToAddressMap`) since v3.0.0 * - `address -> uint256` (`AddressToUintMap`) since v4.6.0 * - `bytes32 -> bytes32` (`Bytes32ToBytes32Map`) since v4.6.0 * - `uint256 -> uint256` (`UintToUintMap`) since v4.7.0 * - `bytes32 -> uint256` (`Bytes32ToUintMap`) since v4.7.0 * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableMap, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableMap. * ==== */ library EnumerableMap { using EnumerableSet for EnumerableSet.Bytes32Set; // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Map type with // bytes32 keys and values. // The Map implementation uses private functions, and user-facing // implementations (such as Uint256ToAddressMap) are just wrappers around // the underlying Map. // This means that we can only create new EnumerableMaps for types that fit // in bytes32. struct Bytes32ToBytes32Map { // Storage of keys EnumerableSet.Bytes32Set _keys; mapping(bytes32 => bytes32) _values; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set( Bytes32ToBytes32Map storage map, bytes32 key, bytes32 value ) internal returns (bool) { map._values[key] = value; return map._keys.add(key); } /** * @dev Removes a key-value pair from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(Bytes32ToBytes32Map storage map, bytes32 key) internal returns (bool) { delete map._values[key]; return map._keys.remove(key); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool) { return map._keys.contains(key); } /** * @dev Returns the number of key-value pairs in the map. O(1). */ function length(Bytes32ToBytes32Map storage map) internal view returns (uint256) { return map._keys.length(); } /** * @dev Returns the key-value pair stored at position `index` in the map. O(1). * * Note that there are no guarantees on the ordering of entries inside the * array, and it may change when more entries are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32ToBytes32Map storage map, uint256 index) internal view returns (bytes32, bytes32) { bytes32 key = map._keys.at(index); return (key, map._values[key]); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function tryGet(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool, bytes32) { bytes32 value = map._values[key]; if (value == bytes32(0)) { return (contains(map, key), bytes32(0)); } else { return (true, value); } } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bytes32) { bytes32 value = map._values[key]; require(value != 0 || contains(map, key), "EnumerableMap: nonexistent key"); return value; } /** * @dev Same as {get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryGet}. */ function get( Bytes32ToBytes32Map storage map, bytes32 key, string memory errorMessage ) internal view returns (bytes32) { bytes32 value = map._values[key]; require(value != 0 || contains(map, key), errorMessage); return value; } // UintToUintMap struct UintToUintMap { Bytes32ToBytes32Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set( UintToUintMap storage map, uint256 key, uint256 value ) internal returns (bool) { return set(map._inner, bytes32(key), bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(UintToUintMap storage map, uint256 key) internal returns (bool) { return remove(map._inner, bytes32(key)); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(UintToUintMap storage map, uint256 key) internal view returns (bool) { return contains(map._inner, bytes32(key)); } /** * @dev Returns the number of elements in the map. O(1). */ function length(UintToUintMap storage map) internal view returns (uint256) { return length(map._inner); } /** * @dev Returns the element stored at position `index` in the set. O(1). * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintToUintMap storage map, uint256 index) internal view returns (uint256, uint256) { (bytes32 key, bytes32 value) = at(map._inner, index); return (uint256(key), uint256(value)); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function tryGet(UintToUintMap storage map, uint256 key) internal view returns (bool, uint256) { (bool success, bytes32 value) = tryGet(map._inner, bytes32(key)); return (success, uint256(value)); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(UintToUintMap storage map, uint256 key) internal view returns (uint256) { return uint256(get(map._inner, bytes32(key))); } /** * @dev Same as {get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryGet}. */ function get( UintToUintMap storage map, uint256 key, string memory errorMessage ) internal view returns (uint256) { return uint256(get(map._inner, bytes32(key), errorMessage)); } // UintToAddressMap struct UintToAddressMap { Bytes32ToBytes32Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set( UintToAddressMap storage map, uint256 key, address value ) internal returns (bool) { return set(map._inner, bytes32(key), bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) { return remove(map._inner, bytes32(key)); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) { return contains(map._inner, bytes32(key)); } /** * @dev Returns the number of elements in the map. O(1). */ function length(UintToAddressMap storage map) internal view returns (uint256) { return length(map._inner); } /** * @dev Returns the element stored at position `index` in the set. O(1). * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) { (bytes32 key, bytes32 value) = at(map._inner, index); return (uint256(key), address(uint160(uint256(value)))); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) { (bool success, bytes32 value) = tryGet(map._inner, bytes32(key)); return (success, address(uint160(uint256(value)))); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(UintToAddressMap storage map, uint256 key) internal view returns (address) { return address(uint160(uint256(get(map._inner, bytes32(key))))); } /** * @dev Same as {get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryGet}. */ function get( UintToAddressMap storage map, uint256 key, string memory errorMessage ) internal view returns (address) { return address(uint160(uint256(get(map._inner, bytes32(key), errorMessage)))); } // AddressToUintMap struct AddressToUintMap { Bytes32ToBytes32Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set( AddressToUintMap storage map, address key, uint256 value ) internal returns (bool) { return set(map._inner, bytes32(uint256(uint160(key))), bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(AddressToUintMap storage map, address key) internal returns (bool) { return remove(map._inner, bytes32(uint256(uint160(key)))); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(AddressToUintMap storage map, address key) internal view returns (bool) { return contains(map._inner, bytes32(uint256(uint160(key)))); } /** * @dev Returns the number of elements in the map. O(1). */ function length(AddressToUintMap storage map) internal view returns (uint256) { return length(map._inner); } /** * @dev Returns the element stored at position `index` in the set. O(1). * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressToUintMap storage map, uint256 index) internal view returns (address, uint256) { (bytes32 key, bytes32 value) = at(map._inner, index); return (address(uint160(uint256(key))), uint256(value)); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function tryGet(AddressToUintMap storage map, address key) internal view returns (bool, uint256) { (bool success, bytes32 value) = tryGet(map._inner, bytes32(uint256(uint160(key)))); return (success, uint256(value)); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(AddressToUintMap storage map, address key) internal view returns (uint256) { return uint256(get(map._inner, bytes32(uint256(uint160(key))))); } /** * @dev Same as {get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryGet}. */ function get( AddressToUintMap storage map, address key, string memory errorMessage ) internal view returns (uint256) { return uint256(get(map._inner, bytes32(uint256(uint160(key))), errorMessage)); } // Bytes32ToUintMap struct Bytes32ToUintMap { Bytes32ToBytes32Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set( Bytes32ToUintMap storage map, bytes32 key, uint256 value ) internal returns (bool) { return set(map._inner, key, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(Bytes32ToUintMap storage map, bytes32 key) internal returns (bool) { return remove(map._inner, key); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool) { return contains(map._inner, key); } /** * @dev Returns the number of elements in the map. O(1). */ function length(Bytes32ToUintMap storage map) internal view returns (uint256) { return length(map._inner); } /** * @dev Returns the element stored at position `index` in the set. O(1). * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32ToUintMap storage map, uint256 index) internal view returns (bytes32, uint256) { (bytes32 key, bytes32 value) = at(map._inner, index); return (key, uint256(value)); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function tryGet(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool, uint256) { (bool success, bytes32 value) = tryGet(map._inner, key); return (success, uint256(value)); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(Bytes32ToUintMap storage map, bytes32 key) internal view returns (uint256) { return uint256(get(map._inner, key)); } /** * @dev Same as {get}, with a custom error message when `key` is not in the map. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryGet}. */ function get( Bytes32ToUintMap storage map, bytes32 key, string memory errorMessage ) internal view returns (uint256) { return uint256(get(map._inner, key, errorMessage)); } } // File contracts/ChivlaryToken.sol pragma solidity ^0.8.0; contract Chivalry is ERC20, Ownable { uint8 private constant _decimals = 18; uint256 public constant MAX_SUPPLY = 1000000000 * (10 ** uint256(_decimals)); // Changed supply to 1 billion tokens bool private _burnEnabled = true; uint256 public constant MIN_VOTE_COUNT = 100; uint256 public constant KNIGHT_NFT_ID = 1; bytes32 private constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)"); bytes32 private constant VOTE_TYPEHASH = keccak256("Vote(address nominee,uint256 deadline)"); using EnumerableMap for EnumerableMap.AddressToUintMap; mapping(address => bytes32) private _committedVotes; EnumerableMap.AddressToUintMap private _nominatedKnightsMap; mapping (address => uint256) private _lastTransferTimestamp; mapping (address => bool) private _nominatedKnights; mapping (address => bool) private _voted; address public currentKnight; uint256 public currentVotes; ERC721 private _nft; event MaxTransferAmountChanged(uint256 newMaxAmount); event BurnEnabledChanged(bool enabled); event KnightNominated(address indexed nominee); event KnightElected(address indexed newKnight); event VoteCountReset(address indexed voter); constructor() ERC20("ChivalryToken", "CHIVA") { // Set initial supply of 1 billion tokens _transferOwnership(msg.sender); _mint(msg.sender, MAX_SUPPLY); } // Function to set the NFT address function setNftAddress(address nftAddress) public onlyOwner { _nft = ERC721(nftAddress); } // Function to remove the NFT address function removeNftAddress() public onlyOwner { _nft = ERC721(address(0)); } function transfer(address recipient, uint256 amount) public virtual override returns (bool) { // Removed the checks for max holding amount, min transfer amount, and max transfer amount uint256 transferAmount = amount; if (_burnEnabled) { uint256 burnAmount = amount / 10; transferAmount = amount - burnAmount; _burn(msg.sender, burnAmount); } _transfer(msg.sender, recipient, transferAmount); _lastTransferTimestamp[msg.sender] = block.timestamp; return true; } function enableBurn() public onlyOwner { _burnEnabled = true; emit BurnEnabledChanged(true); } function disableBurn() public onlyOwner { _burnEnabled = false; emit BurnEnabledChanged(false); } function isBurnEnabled() public view returns (bool) { return _burnEnabled; } function nominateKnight() public { // check if user is eligible to be nominated require(balanceOf(msg.sender) >= MIN_VOTE_COUNT * (10 ** uint256(_decimals)), "Nominee must hold at least 100 votes worth of CHIVA"); require(!_nominatedKnights[msg.sender], "Nominee has already been nominated"); // nominate the user as a potential knight _nominatedKnightsMap.set(msg.sender, 0); // emit event emit KnightNominated(msg.sender); } function resetVoteCount() public { require(_voted[msg.sender], "Sender has not voted before"); // reset vote count for user _voted[msg.sender] = false; // emit event emit VoteCountReset(msg.sender); } // Add a commitVote function that accepts the hash of the vote function commitVote(bytes32 voteHash) public { require(_committedVotes[msg.sender] == 0, "Sender has already committed a vote"); _committedVotes[msg.sender] = voteHash; } function electKnight() public onlyOwner { // find the nominee with the most votes uint256 highestVoteCount = 0; address highestVoteAddress = address(0); address[] memory nominees = getNominees(); for (uint256 i = 0; i < nominees.length; i++) { address nominee = nominees[i]; uint256 voteCount = balanceOf(nominee); if (voteCount > highestVoteCount) { highestVoteCount = voteCount; highestVoteAddress = nominee; } } // transfer knight NFT to the new knight if (highestVoteAddress != address(0)) { _nft.transferFrom(address(this), highestVoteAddress, KNIGHT_NFT_ID); } // set the new knight and reset vote counts currentKnight = highestVoteAddress; currentVotes = highestVoteCount; for (uint256 i = 0; i < nominees.length; i++) { address nominee = nominees[i]; _voted[nominee] = false; } // emit event emit KnightElected(currentKnight); } function getChainId() internal view returns (uint256) { uint256 chainId; assembly { chainId := chainid() } return chainId; } // Update the vote function to accept the revealed vote and compare it to the committed vote function vote(address nominee, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { require(_nominatedKnightsMap.contains(nominee), "Nominee has not been nominated"); require(!_voted[msg.sender], "Sender has already voted"); bytes32 voteHash = keccak256(abi.encodePacked(nominee, deadline, v, r, s)); require(_committedVotes[msg.sender] == voteHash, "Vote does not match the committed vote"); bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name())), getChainId(), address(this))); bytes32 structHash = keccak256(abi.encode(VOTE_TYPEHASH, nominee, deadline)); bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); address signer = ECDSA.recover(digest, v, r, s); require(signer != address(0) && signer == msg.sender, "Invalid signature"); _transfer(msg.sender, nominee, 1 * (10 ** uint256(_decimals))); _voted[msg.sender] = true; } function getNominees() public view returns (address[] memory) { uint256 nomineeCount = 0; for (uint256 i = 0; i < _nominatedKnightsMap.length(); i++) { (address nominee, ) = _nominatedKnightsMap.at(i); if (balanceOf(nominee) >= MIN_VOTE_COUNT * (10 ** uint256(_decimals))) { nomineeCount++; } } address[] memory nominees = new address[](nomineeCount); uint256 j = 0; for (uint256 i = 0; i < _nominatedKnightsMap.length(); i++) { (address nominee, ) = _nominatedKnightsMap.at(i); if (balanceOf(nominee) >= MIN_VOTE_COUNT * (10 ** uint256(_decimals))) { nominees[j] = nominee; j++; } } return nominees; } }
{ "optimizer": { "enabled": false, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"enabled","type":"bool"}],"name":"BurnEnabledChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"newKnight","type":"address"}],"name":"KnightElected","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"nominee","type":"address"}],"name":"KnightNominated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newMaxAmount","type":"uint256"}],"name":"MaxTransferAmountChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"voter","type":"address"}],"name":"VoteCountReset","type":"event"},{"inputs":[],"name":"KNIGHT_NFT_ID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_VOTE_COUNT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"voteHash","type":"bytes32"}],"name":"commitVote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentKnight","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentVotes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"disableBurn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"electKnight","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"enableBurn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getNominees","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isBurnEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nominateKnight","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"removeNftAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"resetVoteCount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"nftAddress","type":"address"}],"name":"setNftAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"nominee","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"vote","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040526001600560146101000a81548160ff0219169083151502179055503480156200002c57600080fd5b506040518060400160405280600d81526020017f43686976616c7279546f6b656e000000000000000000000000000000000000008152506040518060400160405280600581526020017f43484956410000000000000000000000000000000000000000000000000000008152508160039081620000aa9190620005ea565b508060049081620000bc9190620005ea565b505050620000df620000d36200012b60201b60201c565b6200013360201b60201c565b620000f0336200013360201b60201c565b6200012533601260ff16600a62000108919062000854565b633b9aca00620001199190620008a5565b620001f960201b60201c565b620009dc565b600033905090565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036200026b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620002629062000951565b60405180910390fd5b6200027f600083836200036660201b60201c565b806002600082825462000293919062000973565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051620003469190620009bf565b60405180910390a362000362600083836200036b60201b60201c565b5050565b505050565b505050565b600081519050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680620003f257607f821691505b602082108103620004085762000407620003aa565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302620004727fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8262000433565b6200047e868362000433565b95508019841693508086168417925050509392505050565b6000819050919050565b6000819050919050565b6000620004cb620004c5620004bf8462000496565b620004a0565b62000496565b9050919050565b6000819050919050565b620004e783620004aa565b620004ff620004f682620004d2565b84845462000440565b825550505050565b600090565b6200051662000507565b62000523818484620004dc565b505050565b5b818110156200054b576200053f6000826200050c565b60018101905062000529565b5050565b601f8211156200059a5762000564816200040e565b6200056f8462000423565b810160208510156200057f578190505b620005976200058e8562000423565b83018262000528565b50505b505050565b600082821c905092915050565b6000620005bf600019846008026200059f565b1980831691505092915050565b6000620005da8383620005ac565b9150826002028217905092915050565b620005f58262000370565b67ffffffffffffffff8111156200061157620006106200037b565b5b6200061d8254620003d9565b6200062a8282856200054f565b600060209050601f8311600181146200066257600084156200064d578287015190505b620006598582620005cc565b865550620006c9565b601f19841662000672866200040e565b60005b828110156200069c5784890151825560018201915060208501945060208101905062000675565b86831015620006bc5784890151620006b8601f891682620005ac565b8355505b6001600288020188555050505b505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008160011c9050919050565b6000808291508390505b60018511156200075f57808604811115620007375762000736620006d1565b5b6001851615620007475780820291505b8081029050620007578562000700565b945062000717565b94509492505050565b6000826200077a57600190506200084d565b816200078a57600090506200084d565b8160018114620007a35760028114620007ae57620007e4565b60019150506200084d565b60ff841115620007c357620007c2620006d1565b5b8360020a915084821115620007dd57620007dc620006d1565b5b506200084d565b5060208310610133831016604e8410600b84101617156200081e5782820a905083811115620008185762000817620006d1565b5b6200084d565b6200082d84848460016200070d565b92509050818404811115620008475762000846620006d1565b5b81810290505b9392505050565b6000620008618262000496565b91506200086e8362000496565b92506200089d7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff848462000768565b905092915050565b6000620008b28262000496565b9150620008bf8362000496565b9250828202620008cf8162000496565b91508282048414831517620008e957620008e8620006d1565b5b5092915050565b600082825260208201905092915050565b7f45524332303a206d696e7420746f20746865207a65726f206164647265737300600082015250565b600062000939601f83620008f0565b9150620009468262000901565b602082019050919050565b600060208201905081810360008301526200096c816200092a565b9050919050565b6000620009808262000496565b91506200098d8362000496565b9250828201905080821115620009a857620009a7620006d1565b5b92915050565b620009b98162000496565b82525050565b6000602082019050620009d66000830184620009ae565b92915050565b613aad80620009ec6000396000f3fe608060405234801561001057600080fd5b50600436106101da5760003560e01c8063603f7b8c116101045780639636f67c116100a2578063b30394a711610071578063b30394a7146104d9578063c41bcc34146104e3578063dd62ed3e14610501578063f2fde38b14610531576101da565b80639636f67c1461043d578063994ba4d21461045b578063a457c2d714610479578063a9059cbb146104a9576101da565b8063715018a6116100de578063715018a6146103ed57806387e646a9146103f75780638da5cb5b1461040157806395d89b411461041f576101da565b8063603f7b8c1461039557806360963c301461039f57806370a08231146103bd576101da565b806323b872dd1161017c578063395093511161014b57806339509351146103215780633b37d1d6146103515780633e8589231461035b57806340b3a08a14610377576101da565b806323b872dd146102ab5780632403c08e146102db578063313ce567146102e557806332cb6b0c14610303576101da565b8063095ea7b3116101b8578063095ea7b3146102255780630b102d1a146102555780630bf234ec1461027157806318160ddd1461028d576101da565b8063039d6019146101df57806306fdde03146101e957806307ebec2714610207575b600080fd5b6101e761054d565b005b6101f1610676565b6040516101fe9190612415565b60405180910390f35b61020f610708565b60405161021c9190612452565b60405180910390f35b61023f600480360381019061023a9190612506565b61071f565b60405161024c9190612452565b60405180910390f35b61026f600480360381019061026a9190612546565b610742565b005b61028b600480360381019061028691906125e2565b61078e565b005b610295610b46565b6040516102a2919061266c565b60405180910390f35b6102c560048036038101906102c09190612687565b610b50565b6040516102d29190612452565b60405180910390f35b6102e3610b7f565b005b6102ed610bdc565b6040516102fa91906126e9565b60405180910390f35b61030b610be5565b604051610318919061266c565b60405180910390f35b61033b60048036038101906103369190612506565b610c08565b6040516103489190612452565b60405180910390f35b610359610c3f565b005b61037560048036038101906103709190612704565b610c9c565b005b61037f610d67565b60405161038c919061266c565b60405180910390f35b61039d610d6c565b005b6103a7610ebd565b6040516103b49190612740565b60405180910390f35b6103d760048036038101906103d29190612546565b610ee3565b6040516103e4919061266c565b60405180910390f35b6103f5610f2b565b005b6103ff610f3f565b005b610409610f8b565b6040516104169190612740565b60405180910390f35b610427610fb5565b6040516104349190612415565b60405180910390f35b610445611047565b6040516104529190612819565b60405180910390f35b6104636111e7565b604051610470919061266c565b60405180910390f35b610493600480360381019061048e9190612506565b6111ed565b6040516104a09190612452565b60405180910390f35b6104c360048036038101906104be9190612506565b611264565b6040516104d09190612452565b60405180910390f35b6104e1611304565b005b6104eb611589565b6040516104f8919061266c565b60405180910390f35b61051b6004803603810190610516919061283b565b61158e565b604051610528919061266c565b60405180910390f35b61054b60048036038101906105469190612546565b611615565b005b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166105d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d0906128c7565b60405180910390fd5b6000600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff167fb7b599618951f3c8930ac1e25b05ef4b5cff6a6d4a6e3d4c9fbe2ea53453c39a60405160405180910390a2565b60606003805461068590612916565b80601f01602080910402602001604051908101604052809291908181526020018280546106b190612916565b80156106fe5780601f106106d3576101008083540402835291602001916106fe565b820191906000526020600020905b8154815290600101906020018083116106e157829003601f168201915b5050505050905090565b6000600560149054906101000a900460ff16905090565b60008061072a611698565b90506107378185856116a0565b600191505092915050565b61074a611869565b80600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6107a28560076118e790919063ffffffff16565b6107e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107d890612993565b60405180910390fd5b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561086e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610865906129ff565b60405180910390fd5b60008585858585604051602001610889959493929190612adf565b60405160208183030381529060405280519060200120905080600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610922576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091990612bb0565b60405180910390fd5b60007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86661094d610676565b8051906020012061095c611917565b306040516020016109709493929190612bdf565b60405160208183030381529060405280519060200120905060007f12cb402a64c627ec232f9a6077b8dc71f9e4796f7b0f6ad9e88e9ff782119c4f88886040516020016109bf93929190612c24565b604051602081830303815290604052805190602001209050600082826040516020016109ec929190612cb2565b6040516020818303038152906040528051906020012090506000610a1282898989611924565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614158015610a7c57503373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b610abb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ab290612d35565b60405180910390fd5b610ae2338b601260ff16600a610ad19190612eb7565b6001610add9190612f02565b61194f565b6001600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050505050505050505050565b6000600254905090565b600080610b5b611698565b9050610b68858285611bc5565b610b7385858561194f565b60019150509392505050565b610b87611869565b6000600560146101000a81548160ff0219169083151502179055507f66508ba4078184e39e365fc458ca6818ec76fc3416ddfaad565a1b24429021906000604051610bd29190612452565b60405180910390a1565b60006012905090565b601260ff16600a610bf69190612eb7565b633b9aca00610c059190612f02565b81565b600080610c13611698565b9050610c34818585610c25858961158e565b610c2f9190612f44565b6116a0565b600191505092915050565b610c47611869565b6001600560146101000a81548160ff0219169083151502179055507f66508ba4078184e39e365fc458ca6818ec76fc3416ddfaad565a1b24429021906001604051610c929190612452565b60405180910390a1565b6000801b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610d20576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d1790612fea565b60405180910390fd5b80600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b600181565b601260ff16600a610d7d9190612eb7565b6064610d899190612f02565b610d9233610ee3565b1015610dd3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dca9061307c565b60405180910390fd5b600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610e60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e579061310e565b60405180910390fd5b610e773360006007611c519092919063ffffffff16565b503373ffffffffffffffffffffffffffffffffffffffff167ff44f68869896844f5ba9dd3fdbfffcd65e84c564e1c8035785e3fe283726563c60405160405180910390a2565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610f33611869565b610f3d6000611c86565b565b610f47611869565b6000600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060048054610fc490612916565b80601f0160208091040260200160405190810160405280929190818152602001828054610ff090612916565b801561103d5780601f106110125761010080835404028352916020019161103d565b820191906000526020600020905b81548152906001019060200180831161102057829003601f168201915b5050505050905090565b60606000805b6110576007611d4c565b8110156110c5576000611074826007611d6190919063ffffffff16565b509050601260ff16600a6110889190612eb7565b60646110949190612f02565b61109d82610ee3565b106110b15782806110ad9061312e565b9350505b5080806110bd9061312e565b91505061104d565b5060008167ffffffffffffffff8111156110e2576110e1613176565b5b6040519080825280602002602001820160405280156111105781602001602082028036833780820191505090505b5090506000805b6111216007611d4c565b8110156111dd57600061113e826007611d6190919063ffffffff16565b509050601260ff16600a6111529190612eb7565b606461115e9190612f02565b61116782610ee3565b106111c957808484815181106111805761117f6131a5565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505082806111c59061312e565b9350505b5080806111d59061312e565b915050611117565b5081935050505090565b600e5481565b6000806111f8611698565b90506000611206828661158e565b90508381101561124b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161124290613246565b60405180910390fd5b61125882868684036116a0565b60019250505092915050565b600080829050600560149054906101000a900460ff16156112aa576000600a8461128e9190613295565b9050808461129c91906132c6565b91506112a83382611d8d565b505b6112b533858361194f565b42600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600191505092915050565b61130c611869565b6000806000611319611047565b905060005b815181101561137757600082828151811061133c5761133b6131a5565b5b60200260200101519050600061135182610ee3565b905085811115611362578095508194505b5050808061136f9061312e565b91505061131e565b50600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161461143f57600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd308460016040518463ffffffff1660e01b815260040161140c939291906132fa565b600060405180830381600087803b15801561142657600080fd5b505af115801561143a573d6000803e3d6000fd5b505050505b81600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600e8190555060005b815181101561151e5760008282815181106114a8576114a76131a5565b5b602002602001015190506000600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505080806115169061312e565b91505061148a565b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f6e91cbbd97cc2fcc46444ae86626e20f2f7dfd9031cac2faa9cec736ae7bf9ea60405160405180910390a2505050565b606481565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61161d611869565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361168c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611683906133a3565b60405180910390fd5b61169581611c86565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361170f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161170690613435565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361177e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611775906134c7565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161185c919061266c565b60405180910390a3505050565b611871611698565b73ffffffffffffffffffffffffffffffffffffffff1661188f610f8b565b73ffffffffffffffffffffffffffffffffffffffff16146118e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118dc90613533565b60405180910390fd5b565b600061190f836000018373ffffffffffffffffffffffffffffffffffffffff1660001b611f5a565b905092915050565b6000804690508091505090565b600080600061193587878787611f7a565b915091506119428161205c565b8192505050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036119be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119b5906135c5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611a2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a2490613657565b60405180910390fd5b611a388383836121c2565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611abe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ab5906136e9565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611bac919061266c565b60405180910390a3611bbf8484846121c7565b50505050565b6000611bd1848461158e565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114611c4b5781811015611c3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c3490613755565b60405180910390fd5b611c4a84848484036116a0565b5b50505050565b6000611c7d846000018473ffffffffffffffffffffffffffffffffffffffff1660001b8460001b6121cc565b90509392505050565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000611d5a82600001612207565b9050919050565b600080600080611d74866000018661221c565b915091508160001c8160001c9350935050509250929050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611dfc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611df3906137e7565b60405180910390fd5b611e08826000836121c2565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611e8e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e8590613879565b60405180910390fd5b8181036000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600260008282540392505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611f41919061266c565b60405180910390a3611f55836000846121c7565b505050565b6000611f72828460000161225c90919063ffffffff16565b905092915050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c1115611fb5576000600391509150612053565b600060018787878760405160008152602001604052604051611fda9493929190613899565b6020604051602081039080840390855afa158015611ffc573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361204a57600060019250925050612053565b80600092509250505b94509492505050565b600060048111156120705761206f6138de565b5b816004811115612083576120826138de565b5b03156121bf576001600481111561209d5761209c6138de565b5b8160048111156120b0576120af6138de565b5b036120f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120e790613959565b60405180910390fd5b60026004811115612104576121036138de565b5b816004811115612117576121166138de565b5b03612157576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161214e906139c5565b60405180910390fd5b6003600481111561216b5761216a6138de565b5b81600481111561217e5761217d6138de565b5b036121be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121b590613a57565b60405180910390fd5b5b50565b505050565b505050565b600081846002016000858152602001908152602001600020819055506121fe838560000161227390919063ffffffff16565b90509392505050565b60006122158260000161228a565b9050919050565b6000806000612237848660000161229f90919063ffffffff16565b9050808560020160008381526020019081526020016000205492509250509250929050565b600061226b83600001836122b6565b905092915050565b600061228283600001836122d9565b905092915050565b600061229882600001612349565b9050919050565b60006122ae836000018361235a565b905092915050565b600080836001016000848152602001908152602001600020541415905092915050565b60006122e583836122b6565b61233e578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050612343565b600090505b92915050565b600081600001805490509050919050565b6000826000018281548110612372576123716131a5565b5b9060005260206000200154905092915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156123bf5780820151818401526020810190506123a4565b60008484015250505050565b6000601f19601f8301169050919050565b60006123e782612385565b6123f18185612390565b93506124018185602086016123a1565b61240a816123cb565b840191505092915050565b6000602082019050818103600083015261242f81846123dc565b905092915050565b60008115159050919050565b61244c81612437565b82525050565b60006020820190506124676000830184612443565b92915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061249d82612472565b9050919050565b6124ad81612492565b81146124b857600080fd5b50565b6000813590506124ca816124a4565b92915050565b6000819050919050565b6124e3816124d0565b81146124ee57600080fd5b50565b600081359050612500816124da565b92915050565b6000806040838503121561251d5761251c61246d565b5b600061252b858286016124bb565b925050602061253c858286016124f1565b9150509250929050565b60006020828403121561255c5761255b61246d565b5b600061256a848285016124bb565b91505092915050565b600060ff82169050919050565b61258981612573565b811461259457600080fd5b50565b6000813590506125a681612580565b92915050565b6000819050919050565b6125bf816125ac565b81146125ca57600080fd5b50565b6000813590506125dc816125b6565b92915050565b600080600080600060a086880312156125fe576125fd61246d565b5b600061260c888289016124bb565b955050602061261d888289016124f1565b945050604061262e88828901612597565b935050606061263f888289016125cd565b9250506080612650888289016125cd565b9150509295509295909350565b612666816124d0565b82525050565b6000602082019050612681600083018461265d565b92915050565b6000806000606084860312156126a05761269f61246d565b5b60006126ae868287016124bb565b93505060206126bf868287016124bb565b92505060406126d0868287016124f1565b9150509250925092565b6126e381612573565b82525050565b60006020820190506126fe60008301846126da565b92915050565b60006020828403121561271a5761271961246d565b5b6000612728848285016125cd565b91505092915050565b61273a81612492565b82525050565b60006020820190506127556000830184612731565b92915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61279081612492565b82525050565b60006127a28383612787565b60208301905092915050565b6000602082019050919050565b60006127c68261275b565b6127d08185612766565b93506127db83612777565b8060005b8381101561280c5781516127f38882612796565b97506127fe836127ae565b9250506001810190506127df565b5085935050505092915050565b6000602082019050818103600083015261283381846127bb565b905092915050565b600080604083850312156128525761285161246d565b5b6000612860858286016124bb565b9250506020612871858286016124bb565b9150509250929050565b7f53656e64657220686173206e6f7420766f746564206265666f72650000000000600082015250565b60006128b1601b83612390565b91506128bc8261287b565b602082019050919050565b600060208201905081810360008301526128e0816128a4565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061292e57607f821691505b602082108103612941576129406128e7565b5b50919050565b7f4e6f6d696e656520686173206e6f74206265656e206e6f6d696e617465640000600082015250565b600061297d601e83612390565b915061298882612947565b602082019050919050565b600060208201905081810360008301526129ac81612970565b9050919050565b7f53656e6465722068617320616c726561647920766f7465640000000000000000600082015250565b60006129e9601883612390565b91506129f4826129b3565b602082019050919050565b60006020820190508181036000830152612a18816129dc565b9050919050565b60008160601b9050919050565b6000612a3782612a1f565b9050919050565b6000612a4982612a2c565b9050919050565b612a61612a5c82612492565b612a3e565b82525050565b6000819050919050565b612a82612a7d826124d0565b612a67565b82525050565b60008160f81b9050919050565b6000612aa082612a88565b9050919050565b612ab8612ab382612573565b612a95565b82525050565b6000819050919050565b612ad9612ad4826125ac565b612abe565b82525050565b6000612aeb8288612a50565b601482019150612afb8287612a71565b602082019150612b0b8286612aa7565b600182019150612b1b8285612ac8565b602082019150612b2b8284612ac8565b6020820191508190509695505050505050565b7f566f746520646f6573206e6f74206d617463682074686520636f6d6d6974746560008201527f6420766f74650000000000000000000000000000000000000000000000000000602082015250565b6000612b9a602683612390565b9150612ba582612b3e565b604082019050919050565b60006020820190508181036000830152612bc981612b8d565b9050919050565b612bd9816125ac565b82525050565b6000608082019050612bf46000830187612bd0565b612c016020830186612bd0565b612c0e604083018561265d565b612c1b6060830184612731565b95945050505050565b6000606082019050612c396000830186612bd0565b612c466020830185612731565b612c53604083018461265d565b949350505050565b600081905092915050565b7f1901000000000000000000000000000000000000000000000000000000000000600082015250565b6000612c9c600283612c5b565b9150612ca782612c66565b600282019050919050565b6000612cbd82612c8f565b9150612cc98285612ac8565b602082019150612cd98284612ac8565b6020820191508190509392505050565b7f496e76616c6964207369676e6174757265000000000000000000000000000000600082015250565b6000612d1f601183612390565b9150612d2a82612ce9565b602082019050919050565b60006020820190508181036000830152612d4e81612d12565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008160011c9050919050565b6000808291508390505b6001851115612ddb57808604811115612db757612db6612d55565b5b6001851615612dc65780820291505b8081029050612dd485612d84565b9450612d9b565b94509492505050565b600082612df45760019050612eb0565b81612e025760009050612eb0565b8160018114612e185760028114612e2257612e51565b6001915050612eb0565b60ff841115612e3457612e33612d55565b5b8360020a915084821115612e4b57612e4a612d55565b5b50612eb0565b5060208310610133831016604e8410600b8410161715612e865782820a905083811115612e8157612e80612d55565b5b612eb0565b612e938484846001612d91565b92509050818404811115612eaa57612ea9612d55565b5b81810290505b9392505050565b6000612ec2826124d0565b9150612ecd836124d0565b9250612efa7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484612de4565b905092915050565b6000612f0d826124d0565b9150612f18836124d0565b9250828202612f26816124d0565b91508282048414831517612f3d57612f3c612d55565b5b5092915050565b6000612f4f826124d0565b9150612f5a836124d0565b9250828201905080821115612f7257612f71612d55565b5b92915050565b7f53656e6465722068617320616c726561647920636f6d6d69747465642061207660008201527f6f74650000000000000000000000000000000000000000000000000000000000602082015250565b6000612fd4602383612390565b9150612fdf82612f78565b604082019050919050565b6000602082019050818103600083015261300381612fc7565b9050919050565b7f4e6f6d696e6565206d75737420686f6c64206174206c6561737420313030207660008201527f6f74657320776f727468206f6620434849564100000000000000000000000000602082015250565b6000613066603383612390565b91506130718261300a565b604082019050919050565b6000602082019050818103600083015261309581613059565b9050919050565b7f4e6f6d696e65652068617320616c7265616479206265656e206e6f6d696e617460008201527f6564000000000000000000000000000000000000000000000000000000000000602082015250565b60006130f8602283612390565b91506131038261309c565b604082019050919050565b60006020820190508181036000830152613127816130eb565b9050919050565b6000613139826124d0565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361316b5761316a612d55565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6000613230602583612390565b915061323b826131d4565b604082019050919050565b6000602082019050818103600083015261325f81613223565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006132a0826124d0565b91506132ab836124d0565b9250826132bb576132ba613266565b5b828204905092915050565b60006132d1826124d0565b91506132dc836124d0565b92508282039050818111156132f4576132f3612d55565b5b92915050565b600060608201905061330f6000830186612731565b61331c6020830185612731565b613329604083018461265d565b949350505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600061338d602683612390565b915061339882613331565b604082019050919050565b600060208201905081810360008301526133bc81613380565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b600061341f602483612390565b915061342a826133c3565b604082019050919050565b6000602082019050818103600083015261344e81613412565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006134b1602283612390565b91506134bc82613455565b604082019050919050565b600060208201905081810360008301526134e0816134a4565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061351d602083612390565b9150613528826134e7565b602082019050919050565b6000602082019050818103600083015261354c81613510565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006135af602583612390565b91506135ba82613553565b604082019050919050565b600060208201905081810360008301526135de816135a2565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000613641602383612390565b915061364c826135e5565b604082019050919050565b6000602082019050818103600083015261367081613634565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b60006136d3602683612390565b91506136de82613677565b604082019050919050565b60006020820190508181036000830152613702816136c6565b9050919050565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000600082015250565b600061373f601d83612390565b915061374a82613709565b602082019050919050565b6000602082019050818103600083015261376e81613732565b9050919050565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b60006137d1602183612390565b91506137dc82613775565b604082019050919050565b60006020820190508181036000830152613800816137c4565b9050919050565b7f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60008201527f6365000000000000000000000000000000000000000000000000000000000000602082015250565b6000613863602283612390565b915061386e82613807565b604082019050919050565b6000602082019050818103600083015261389281613856565b9050919050565b60006080820190506138ae6000830187612bd0565b6138bb60208301866126da565b6138c86040830185612bd0565b6138d56060830184612bd0565b95945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b6000613943601883612390565b915061394e8261390d565b602082019050919050565b6000602082019050818103600083015261397281613936565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b60006139af601f83612390565b91506139ba82613979565b602082019050919050565b600060208201905081810360008301526139de816139a2565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b6000613a41602283612390565b9150613a4c826139e5565b604082019050919050565b60006020820190508181036000830152613a7081613a34565b905091905056fea264697066735822122047064546fa71f8360e894af22d5cf14ec1af63df49401d1dea0311fffcdceb9c64736f6c63430008120033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101da5760003560e01c8063603f7b8c116101045780639636f67c116100a2578063b30394a711610071578063b30394a7146104d9578063c41bcc34146104e3578063dd62ed3e14610501578063f2fde38b14610531576101da565b80639636f67c1461043d578063994ba4d21461045b578063a457c2d714610479578063a9059cbb146104a9576101da565b8063715018a6116100de578063715018a6146103ed57806387e646a9146103f75780638da5cb5b1461040157806395d89b411461041f576101da565b8063603f7b8c1461039557806360963c301461039f57806370a08231146103bd576101da565b806323b872dd1161017c578063395093511161014b57806339509351146103215780633b37d1d6146103515780633e8589231461035b57806340b3a08a14610377576101da565b806323b872dd146102ab5780632403c08e146102db578063313ce567146102e557806332cb6b0c14610303576101da565b8063095ea7b3116101b8578063095ea7b3146102255780630b102d1a146102555780630bf234ec1461027157806318160ddd1461028d576101da565b8063039d6019146101df57806306fdde03146101e957806307ebec2714610207575b600080fd5b6101e761054d565b005b6101f1610676565b6040516101fe9190612415565b60405180910390f35b61020f610708565b60405161021c9190612452565b60405180910390f35b61023f600480360381019061023a9190612506565b61071f565b60405161024c9190612452565b60405180910390f35b61026f600480360381019061026a9190612546565b610742565b005b61028b600480360381019061028691906125e2565b61078e565b005b610295610b46565b6040516102a2919061266c565b60405180910390f35b6102c560048036038101906102c09190612687565b610b50565b6040516102d29190612452565b60405180910390f35b6102e3610b7f565b005b6102ed610bdc565b6040516102fa91906126e9565b60405180910390f35b61030b610be5565b604051610318919061266c565b60405180910390f35b61033b60048036038101906103369190612506565b610c08565b6040516103489190612452565b60405180910390f35b610359610c3f565b005b61037560048036038101906103709190612704565b610c9c565b005b61037f610d67565b60405161038c919061266c565b60405180910390f35b61039d610d6c565b005b6103a7610ebd565b6040516103b49190612740565b60405180910390f35b6103d760048036038101906103d29190612546565b610ee3565b6040516103e4919061266c565b60405180910390f35b6103f5610f2b565b005b6103ff610f3f565b005b610409610f8b565b6040516104169190612740565b60405180910390f35b610427610fb5565b6040516104349190612415565b60405180910390f35b610445611047565b6040516104529190612819565b60405180910390f35b6104636111e7565b604051610470919061266c565b60405180910390f35b610493600480360381019061048e9190612506565b6111ed565b6040516104a09190612452565b60405180910390f35b6104c360048036038101906104be9190612506565b611264565b6040516104d09190612452565b60405180910390f35b6104e1611304565b005b6104eb611589565b6040516104f8919061266c565b60405180910390f35b61051b6004803603810190610516919061283b565b61158e565b604051610528919061266c565b60405180910390f35b61054b60048036038101906105469190612546565b611615565b005b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff166105d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d0906128c7565b60405180910390fd5b6000600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff167fb7b599618951f3c8930ac1e25b05ef4b5cff6a6d4a6e3d4c9fbe2ea53453c39a60405160405180910390a2565b60606003805461068590612916565b80601f01602080910402602001604051908101604052809291908181526020018280546106b190612916565b80156106fe5780601f106106d3576101008083540402835291602001916106fe565b820191906000526020600020905b8154815290600101906020018083116106e157829003601f168201915b5050505050905090565b6000600560149054906101000a900460ff16905090565b60008061072a611698565b90506107378185856116a0565b600191505092915050565b61074a611869565b80600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6107a28560076118e790919063ffffffff16565b6107e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107d890612993565b60405180910390fd5b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161561086e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610865906129ff565b60405180910390fd5b60008585858585604051602001610889959493929190612adf565b60405160208183030381529060405280519060200120905080600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610922576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091990612bb0565b60405180910390fd5b60007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86661094d610676565b8051906020012061095c611917565b306040516020016109709493929190612bdf565b60405160208183030381529060405280519060200120905060007f12cb402a64c627ec232f9a6077b8dc71f9e4796f7b0f6ad9e88e9ff782119c4f88886040516020016109bf93929190612c24565b604051602081830303815290604052805190602001209050600082826040516020016109ec929190612cb2565b6040516020818303038152906040528051906020012090506000610a1282898989611924565b9050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614158015610a7c57503373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b610abb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ab290612d35565b60405180910390fd5b610ae2338b601260ff16600a610ad19190612eb7565b6001610add9190612f02565b61194f565b6001600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050505050505050505050565b6000600254905090565b600080610b5b611698565b9050610b68858285611bc5565b610b7385858561194f565b60019150509392505050565b610b87611869565b6000600560146101000a81548160ff0219169083151502179055507f66508ba4078184e39e365fc458ca6818ec76fc3416ddfaad565a1b24429021906000604051610bd29190612452565b60405180910390a1565b60006012905090565b601260ff16600a610bf69190612eb7565b633b9aca00610c059190612f02565b81565b600080610c13611698565b9050610c34818585610c25858961158e565b610c2f9190612f44565b6116a0565b600191505092915050565b610c47611869565b6001600560146101000a81548160ff0219169083151502179055507f66508ba4078184e39e365fc458ca6818ec76fc3416ddfaad565a1b24429021906001604051610c929190612452565b60405180910390a1565b6000801b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610d20576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d1790612fea565b60405180910390fd5b80600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b600181565b601260ff16600a610d7d9190612eb7565b6064610d899190612f02565b610d9233610ee3565b1015610dd3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dca9061307c565b60405180910390fd5b600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610e60576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e579061310e565b60405180910390fd5b610e773360006007611c519092919063ffffffff16565b503373ffffffffffffffffffffffffffffffffffffffff167ff44f68869896844f5ba9dd3fdbfffcd65e84c564e1c8035785e3fe283726563c60405160405180910390a2565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610f33611869565b610f3d6000611c86565b565b610f47611869565b6000600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060048054610fc490612916565b80601f0160208091040260200160405190810160405280929190818152602001828054610ff090612916565b801561103d5780601f106110125761010080835404028352916020019161103d565b820191906000526020600020905b81548152906001019060200180831161102057829003601f168201915b5050505050905090565b60606000805b6110576007611d4c565b8110156110c5576000611074826007611d6190919063ffffffff16565b509050601260ff16600a6110889190612eb7565b60646110949190612f02565b61109d82610ee3565b106110b15782806110ad9061312e565b9350505b5080806110bd9061312e565b91505061104d565b5060008167ffffffffffffffff8111156110e2576110e1613176565b5b6040519080825280602002602001820160405280156111105781602001602082028036833780820191505090505b5090506000805b6111216007611d4c565b8110156111dd57600061113e826007611d6190919063ffffffff16565b509050601260ff16600a6111529190612eb7565b606461115e9190612f02565b61116782610ee3565b106111c957808484815181106111805761117f6131a5565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505082806111c59061312e565b9350505b5080806111d59061312e565b915050611117565b5081935050505090565b600e5481565b6000806111f8611698565b90506000611206828661158e565b90508381101561124b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161124290613246565b60405180910390fd5b61125882868684036116a0565b60019250505092915050565b600080829050600560149054906101000a900460ff16156112aa576000600a8461128e9190613295565b9050808461129c91906132c6565b91506112a83382611d8d565b505b6112b533858361194f565b42600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600191505092915050565b61130c611869565b6000806000611319611047565b905060005b815181101561137757600082828151811061133c5761133b6131a5565b5b60200260200101519050600061135182610ee3565b905085811115611362578095508194505b5050808061136f9061312e565b91505061131e565b50600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161461143f57600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd308460016040518463ffffffff1660e01b815260040161140c939291906132fa565b600060405180830381600087803b15801561142657600080fd5b505af115801561143a573d6000803e3d6000fd5b505050505b81600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600e8190555060005b815181101561151e5760008282815181106114a8576114a76131a5565b5b602002602001015190506000600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505080806115169061312e565b91505061148a565b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f6e91cbbd97cc2fcc46444ae86626e20f2f7dfd9031cac2faa9cec736ae7bf9ea60405160405180910390a2505050565b606481565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61161d611869565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361168c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611683906133a3565b60405180910390fd5b61169581611c86565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361170f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161170690613435565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361177e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611775906134c7565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161185c919061266c565b60405180910390a3505050565b611871611698565b73ffffffffffffffffffffffffffffffffffffffff1661188f610f8b565b73ffffffffffffffffffffffffffffffffffffffff16146118e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118dc90613533565b60405180910390fd5b565b600061190f836000018373ffffffffffffffffffffffffffffffffffffffff1660001b611f5a565b905092915050565b6000804690508091505090565b600080600061193587878787611f7a565b915091506119428161205c565b8192505050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036119be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119b5906135c5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611a2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a2490613657565b60405180910390fd5b611a388383836121c2565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611abe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ab5906136e9565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611bac919061266c565b60405180910390a3611bbf8484846121c7565b50505050565b6000611bd1848461158e565b90507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114611c4b5781811015611c3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c3490613755565b60405180910390fd5b611c4a84848484036116a0565b5b50505050565b6000611c7d846000018473ffffffffffffffffffffffffffffffffffffffff1660001b8460001b6121cc565b90509392505050565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000611d5a82600001612207565b9050919050565b600080600080611d74866000018661221c565b915091508160001c8160001c9350935050509250929050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611dfc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611df3906137e7565b60405180910390fd5b611e08826000836121c2565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611e8e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e8590613879565b60405180910390fd5b8181036000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600260008282540392505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611f41919061266c565b60405180910390a3611f55836000846121c7565b505050565b6000611f72828460000161225c90919063ffffffff16565b905092915050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c1115611fb5576000600391509150612053565b600060018787878760405160008152602001604052604051611fda9493929190613899565b6020604051602081039080840390855afa158015611ffc573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361204a57600060019250925050612053565b80600092509250505b94509492505050565b600060048111156120705761206f6138de565b5b816004811115612083576120826138de565b5b03156121bf576001600481111561209d5761209c6138de565b5b8160048111156120b0576120af6138de565b5b036120f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120e790613959565b60405180910390fd5b60026004811115612104576121036138de565b5b816004811115612117576121166138de565b5b03612157576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161214e906139c5565b60405180910390fd5b6003600481111561216b5761216a6138de565b5b81600481111561217e5761217d6138de565b5b036121be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121b590613a57565b60405180910390fd5b5b50565b505050565b505050565b600081846002016000858152602001908152602001600020819055506121fe838560000161227390919063ffffffff16565b90509392505050565b60006122158260000161228a565b9050919050565b6000806000612237848660000161229f90919063ffffffff16565b9050808560020160008381526020019081526020016000205492509250509250929050565b600061226b83600001836122b6565b905092915050565b600061228283600001836122d9565b905092915050565b600061229882600001612349565b9050919050565b60006122ae836000018361235a565b905092915050565b600080836001016000848152602001908152602001600020541415905092915050565b60006122e583836122b6565b61233e578260000182908060018154018082558091505060019003906000526020600020016000909190919091505582600001805490508360010160008481526020019081526020016000208190555060019050612343565b600090505b92915050565b600081600001805490509050919050565b6000826000018281548110612372576123716131a5565b5b9060005260206000200154905092915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156123bf5780820151818401526020810190506123a4565b60008484015250505050565b6000601f19601f8301169050919050565b60006123e782612385565b6123f18185612390565b93506124018185602086016123a1565b61240a816123cb565b840191505092915050565b6000602082019050818103600083015261242f81846123dc565b905092915050565b60008115159050919050565b61244c81612437565b82525050565b60006020820190506124676000830184612443565b92915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061249d82612472565b9050919050565b6124ad81612492565b81146124b857600080fd5b50565b6000813590506124ca816124a4565b92915050565b6000819050919050565b6124e3816124d0565b81146124ee57600080fd5b50565b600081359050612500816124da565b92915050565b6000806040838503121561251d5761251c61246d565b5b600061252b858286016124bb565b925050602061253c858286016124f1565b9150509250929050565b60006020828403121561255c5761255b61246d565b5b600061256a848285016124bb565b91505092915050565b600060ff82169050919050565b61258981612573565b811461259457600080fd5b50565b6000813590506125a681612580565b92915050565b6000819050919050565b6125bf816125ac565b81146125ca57600080fd5b50565b6000813590506125dc816125b6565b92915050565b600080600080600060a086880312156125fe576125fd61246d565b5b600061260c888289016124bb565b955050602061261d888289016124f1565b945050604061262e88828901612597565b935050606061263f888289016125cd565b9250506080612650888289016125cd565b9150509295509295909350565b612666816124d0565b82525050565b6000602082019050612681600083018461265d565b92915050565b6000806000606084860312156126a05761269f61246d565b5b60006126ae868287016124bb565b93505060206126bf868287016124bb565b92505060406126d0868287016124f1565b9150509250925092565b6126e381612573565b82525050565b60006020820190506126fe60008301846126da565b92915050565b60006020828403121561271a5761271961246d565b5b6000612728848285016125cd565b91505092915050565b61273a81612492565b82525050565b60006020820190506127556000830184612731565b92915050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61279081612492565b82525050565b60006127a28383612787565b60208301905092915050565b6000602082019050919050565b60006127c68261275b565b6127d08185612766565b93506127db83612777565b8060005b8381101561280c5781516127f38882612796565b97506127fe836127ae565b9250506001810190506127df565b5085935050505092915050565b6000602082019050818103600083015261283381846127bb565b905092915050565b600080604083850312156128525761285161246d565b5b6000612860858286016124bb565b9250506020612871858286016124bb565b9150509250929050565b7f53656e64657220686173206e6f7420766f746564206265666f72650000000000600082015250565b60006128b1601b83612390565b91506128bc8261287b565b602082019050919050565b600060208201905081810360008301526128e0816128a4565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061292e57607f821691505b602082108103612941576129406128e7565b5b50919050565b7f4e6f6d696e656520686173206e6f74206265656e206e6f6d696e617465640000600082015250565b600061297d601e83612390565b915061298882612947565b602082019050919050565b600060208201905081810360008301526129ac81612970565b9050919050565b7f53656e6465722068617320616c726561647920766f7465640000000000000000600082015250565b60006129e9601883612390565b91506129f4826129b3565b602082019050919050565b60006020820190508181036000830152612a18816129dc565b9050919050565b60008160601b9050919050565b6000612a3782612a1f565b9050919050565b6000612a4982612a2c565b9050919050565b612a61612a5c82612492565b612a3e565b82525050565b6000819050919050565b612a82612a7d826124d0565b612a67565b82525050565b60008160f81b9050919050565b6000612aa082612a88565b9050919050565b612ab8612ab382612573565b612a95565b82525050565b6000819050919050565b612ad9612ad4826125ac565b612abe565b82525050565b6000612aeb8288612a50565b601482019150612afb8287612a71565b602082019150612b0b8286612aa7565b600182019150612b1b8285612ac8565b602082019150612b2b8284612ac8565b6020820191508190509695505050505050565b7f566f746520646f6573206e6f74206d617463682074686520636f6d6d6974746560008201527f6420766f74650000000000000000000000000000000000000000000000000000602082015250565b6000612b9a602683612390565b9150612ba582612b3e565b604082019050919050565b60006020820190508181036000830152612bc981612b8d565b9050919050565b612bd9816125ac565b82525050565b6000608082019050612bf46000830187612bd0565b612c016020830186612bd0565b612c0e604083018561265d565b612c1b6060830184612731565b95945050505050565b6000606082019050612c396000830186612bd0565b612c466020830185612731565b612c53604083018461265d565b949350505050565b600081905092915050565b7f1901000000000000000000000000000000000000000000000000000000000000600082015250565b6000612c9c600283612c5b565b9150612ca782612c66565b600282019050919050565b6000612cbd82612c8f565b9150612cc98285612ac8565b602082019150612cd98284612ac8565b6020820191508190509392505050565b7f496e76616c6964207369676e6174757265000000000000000000000000000000600082015250565b6000612d1f601183612390565b9150612d2a82612ce9565b602082019050919050565b60006020820190508181036000830152612d4e81612d12565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008160011c9050919050565b6000808291508390505b6001851115612ddb57808604811115612db757612db6612d55565b5b6001851615612dc65780820291505b8081029050612dd485612d84565b9450612d9b565b94509492505050565b600082612df45760019050612eb0565b81612e025760009050612eb0565b8160018114612e185760028114612e2257612e51565b6001915050612eb0565b60ff841115612e3457612e33612d55565b5b8360020a915084821115612e4b57612e4a612d55565b5b50612eb0565b5060208310610133831016604e8410600b8410161715612e865782820a905083811115612e8157612e80612d55565b5b612eb0565b612e938484846001612d91565b92509050818404811115612eaa57612ea9612d55565b5b81810290505b9392505050565b6000612ec2826124d0565b9150612ecd836124d0565b9250612efa7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484612de4565b905092915050565b6000612f0d826124d0565b9150612f18836124d0565b9250828202612f26816124d0565b91508282048414831517612f3d57612f3c612d55565b5b5092915050565b6000612f4f826124d0565b9150612f5a836124d0565b9250828201905080821115612f7257612f71612d55565b5b92915050565b7f53656e6465722068617320616c726561647920636f6d6d69747465642061207660008201527f6f74650000000000000000000000000000000000000000000000000000000000602082015250565b6000612fd4602383612390565b9150612fdf82612f78565b604082019050919050565b6000602082019050818103600083015261300381612fc7565b9050919050565b7f4e6f6d696e6565206d75737420686f6c64206174206c6561737420313030207660008201527f6f74657320776f727468206f6620434849564100000000000000000000000000602082015250565b6000613066603383612390565b91506130718261300a565b604082019050919050565b6000602082019050818103600083015261309581613059565b9050919050565b7f4e6f6d696e65652068617320616c7265616479206265656e206e6f6d696e617460008201527f6564000000000000000000000000000000000000000000000000000000000000602082015250565b60006130f8602283612390565b91506131038261309c565b604082019050919050565b60006020820190508181036000830152613127816130eb565b9050919050565b6000613139826124d0565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361316b5761316a612d55565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6000613230602583612390565b915061323b826131d4565b604082019050919050565b6000602082019050818103600083015261325f81613223565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006132a0826124d0565b91506132ab836124d0565b9250826132bb576132ba613266565b5b828204905092915050565b60006132d1826124d0565b91506132dc836124d0565b92508282039050818111156132f4576132f3612d55565b5b92915050565b600060608201905061330f6000830186612731565b61331c6020830185612731565b613329604083018461265d565b949350505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600061338d602683612390565b915061339882613331565b604082019050919050565b600060208201905081810360008301526133bc81613380565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b600061341f602483612390565b915061342a826133c3565b604082019050919050565b6000602082019050818103600083015261344e81613412565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006134b1602283612390565b91506134bc82613455565b604082019050919050565b600060208201905081810360008301526134e0816134a4565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061351d602083612390565b9150613528826134e7565b602082019050919050565b6000602082019050818103600083015261354c81613510565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006135af602583612390565b91506135ba82613553565b604082019050919050565b600060208201905081810360008301526135de816135a2565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000613641602383612390565b915061364c826135e5565b604082019050919050565b6000602082019050818103600083015261367081613634565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b60006136d3602683612390565b91506136de82613677565b604082019050919050565b60006020820190508181036000830152613702816136c6565b9050919050565b7f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000600082015250565b600061373f601d83612390565b915061374a82613709565b602082019050919050565b6000602082019050818103600083015261376e81613732565b9050919050565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b60006137d1602183612390565b91506137dc82613775565b604082019050919050565b60006020820190508181036000830152613800816137c4565b9050919050565b7f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60008201527f6365000000000000000000000000000000000000000000000000000000000000602082015250565b6000613863602283612390565b915061386e82613807565b604082019050919050565b6000602082019050818103600083015261389281613856565b9050919050565b60006080820190506138ae6000830187612bd0565b6138bb60208301866126da565b6138c86040830185612bd0565b6138d56060830184612bd0565b95945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b6000613943601883612390565b915061394e8261390d565b602082019050919050565b6000602082019050818103600083015261397281613936565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b60006139af601f83612390565b91506139ba82613979565b602082019050919050565b600060208201905081810360008301526139de816139a2565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b6000613a41602283612390565b9150613a4c826139e5565b604082019050919050565b60006020820190508181036000830152613a7081613a34565b905091905056fea264697066735822122047064546fa71f8360e894af22d5cf14ec1af63df49401d1dea0311fffcdceb9c64736f6c63430008120033
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.