Feature Tip: Add private address tag to any address under My Name Tag !
ERC-721
Overview
Max Total Supply
0 MONS
Holders
889
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Balance
1 MONSLoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
DefimonsStarterMonsters
Compiler Version
v0.8.13+commit.abaa5c0e
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
//SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { MerkleProof } from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import { Math } from "@openzeppelin/contracts/utils/math/Math.sol"; import { ONFT721 } from "./dependencies/omnichain/token/onft/ONFT721.sol"; /// @title Defimons Starter Monsters /// @notice This contract mints Defimons Starter Monsters on sales started and parametrized by the owner. contract DefimonsStarterMonsters is ONFT721 { // // Using Statements // using MerkleProof for bytes32[]; using SafeERC20 for IERC20; // // Errors // /// Throws when creating/editing a sale and the start time is bigger than the finish time error InvalidSaleIntervalError(uint256 start, uint256 finish); /// Throws when creating/editing a sale and it is of type whitelist but the provided root is 0 error InvalidWhitelistRootError(); /// Throws when a sale with max mint is created/edited with a max mint of 0 error InvalidSaleMaxMintError(); /// Throws when the sale does not exist error SaleNotFoundError(uint256 saleId); ///Throws when a user wants to mint 0 tokens error ZeroMintQuantityError(); /// Throws when the current timestamp is not within the sale interval error NotInSalePhaseError(uint256 saleId, uint256 start, uint256 finish, uint256 current); /// Throws when the user is not whitelisted for the sale (wrong proof) error UserNotWhitelistedOrWrongProofError(uint256 saleId, address user, bytes32[] proof); /// Throws when the user does not send the right ether value for the mint error WrongValueSentForMintError(uint256 saleId, uint256 value, uint256 price, uint256 quantity); /// Throws when the user tries to mint more than their allowance error MaximumSaleLimitReachedError(uint256 saleId, address user, uint256 limit); /// Throws when the user tries to mint more than the max mint for a certain sale error MaximumSaleMintSupplyReachedError(uint256 saleId); /// Throws when the user tries to mint more than the max mint for all sales error MaximumTotalMintSupplyReachedError(); /// Throws when the owner is changing the max mint supply and the value is the same as the previous one error StaleMaxMintUpdateError(); /// Throws when the number of addresses and amounts given in the owner mint are not the same error AddressessAmountsLengthsMismatchError(); /// Throws when the owner tries to mint tokens for 0 users error ZeroUsersToMintError(); /// Throws when an address to mint for is 0 error ZeroAddressError(); // // Events // /* * @notice Emitted when the token's URI is changed * @param newURI The new URI */ event LogSetURI(string newURI); /* * @notice Emitted when a sale is created * @param saleId The sale's ID * @param start The sale's start time * @param finish The sale's finish time * @param limit The sale's limit per user * @param price The sale's price * @param whitelist Whether the sale is of type whitelist or not * @param root The sale's merkle root (does not matter for public sales) * @param hasMaxMint Whether the sale has a max mint or not * @param maxMint The sale's max mint (does not matter if hasMaxMint is false) */ event LogSaleCreated( uint256 indexed saleId, uint64 start, uint64 finish, uint8 limit, uint64 price, bool whitelist, bytes32 root, bool hasMaxMint, uint40 maxMint ); /* * @notice Emitted when a sale is edited * @param saleId The sale's ID * @param start The sale's start time * @param finish The sale's finish time * @param limit The sale's limit per user (applicable only for public sales) * @param price The sale's price * @param whitelist Whether the sale is of type whitelist or not * @param root The sale's merkle root (does not matter for public sales) * @param hasMaxMint Whether the sale has a max mint or not * @param maxMint The sale's max mint (does not matter if hasMaxMint is false) */ event LogSaleEdited( uint256 indexed saleId, uint64 start, uint64 finish, uint8 limit, uint64 price, bool whitelist, bytes32 root, bool hasMaxMint, uint40 maxMint ); /* * @notice Emitted when tokens are sold on a sale * @param saleId The sale's ID * @param to The address that bought the token * @param quantity The quantity of tokens bought */ event LogSale(uint256 indexed saleId, address indexed to, uint256 quantity); /* Emitted when the max mint supply is changed * @param prevMaxMint The previous max mint supply * @param newMaxMint The new max mint supply */ event LogSetMaxMint(uint256 prevMaxMint, uint256 newMaxMint); event LogRefund(uint256 indexed saleId, address indexed to, uint256 value); event LogOwnerMint(address[] users, uint256[] amounts); // // Structs // /// Defines the parameters for a sale period. /// This is created by the contract's Sale Admin. /// A sale is active when block.timestamp in interval [start, finish]. /// The limit per user of a whitelist sale is stored in the merkle root. /// @param root The current sale's merkle root (0 for public sales). /// @param whitelist True for whitelist, false for public. /// @param start The sale's start time. /// @param finish The sale's finish time. /// @param price The NFT price on this sale. /// @param limit The sale's limit per user (applicable only for public sales). /// @param hasMaxMint Whether the sale has a max mint or not. /// @param maxMint The sale's max mint (does not matter if hasMaxMint is false). struct Sale { bytes32 root; bool whitelist; uint64 start; uint64 finish; uint64 price; uint8 limit; bool hasMaxMint; uint40 maxMint; } // // Sales Variables // // // State // /// Max total mint uint256 public maxMint; /// Base NFT metadata URI. string private _URI; /// Id of the next NFT id to mint (sequential id). uint256 public nextToMint = 1; /// List of sale phases. Sale[] private _sales; /// Mapping of the quantity of NFTs minted to each address. /// Used to track and cap how many tokens an address is allowed to mint per round. /// current sale id => user address => number of NFTs minted mapping(uint256 => mapping(address => uint256)) private _minted; /// Mapping of the quantity of NFTs minted on each sale. /// Used to track and cap how many tokens are minted per sale. mapping(uint256 => uint256) private _mintedTotal; // // ERC721 // /// @dev See {IERC721Metadata-tokenURI}. function _baseURI() internal view override returns (string memory) { return _URI; } /// @param name_ The name of the NFT /// @param symbol_ The symbol of the NFT /// @param lzEndpoint_ The endpoint of the LayerZero endpoint /// @param initialURI_ The initial base URI /// @param maxMint_ The total maximum number of NFTs that can be minted constructor( string memory name_, string memory symbol_, address lzEndpoint_, string memory initialURI_, uint256 maxMint_ ) ONFT721(name_, symbol_, lzEndpoint_) { setURI(initialURI_); setMaxMint(maxMint_); } // // Owner API // /// @notice Sets the new base URI /// @dev Can only be called by the contract owner. /// @param newURI_ The new base URI function setURI(string memory newURI_) public onlyOwner { _URI = newURI_; emit LogSetURI(newURI_); } /// @notice Adds a new sale period. /// @dev Can only be called by the contract owner. /// @param start_ The start of the sale. /// @param finish_ The end of the sale. /// @param _limit The maximum number of NFTs an account can mint during this period. /// @param _price The price of each NFT during this period. /// @param whitelist_ Whether the sale is a whitelist sale /// @param root_ When adding a whitelist sale, this parameter defines the merkle root to be used for verification. /// @param hasMaxMint_ Whether the sale has a max mint /// @param maxMint_ The max mint for the sale function addSale( uint64 start_, uint64 finish_, uint8 _limit, uint64 _price, bool whitelist_, bytes32 root_, bool hasMaxMint_, uint40 maxMint_ ) external onlyOwner { // sale Id does not matter when adding a sale _validateSaleParams(start_, finish_, whitelist_, root_, hasMaxMint_, maxMint_); Sale memory sale_ = Sale({ start: start_, finish: finish_, limit: _limit, price: _price, whitelist: whitelist_, root: root_, hasMaxMint: hasMaxMint_, maxMint: maxMint_ }); _sales.push(sale_); emit LogSaleCreated( _sales.length - 1, start_, finish_, _limit, _price, whitelist_, root_, hasMaxMint_, maxMint_ ); } /// @notice Edits a Sale Phase. Can't change the hasMaxMint property, only the maxMint property. /// @dev Can only be called by the contract owner. /// @param saleId_ The unique ID of the sale to be edited /// @param start_ The new start time we want the sale to have /// @param finish_ The new end time we want the sale to have /// @param _limit The new limit of NFTs we want the sale to have /// @param _price The new price we want the NFTs to have /// @param whitelist_ Whether it is a whitelist sale /// @param root_ Defines the root to be used for whitelist verification /// @param maxMint_ The new max mint we want the sale to have /// If we want any Sale parameter to stay unchanged, send the same value as a parameter to the function function editSale( uint256 saleId_, uint64 start_, uint64 finish_, uint8 _limit, uint64 _price, bool whitelist_, bytes32 root_, uint40 maxMint_ ) external onlyOwner { if (saleId_ >= _sales.length) revert SaleNotFoundError(saleId_); Sale memory sale_ = _sales[saleId_]; _validateSaleParams(start_, finish_, whitelist_, root_, sale_.hasMaxMint, maxMint_); if (sale_.hasMaxMint && maxMint_ < sale_.maxMint) { maxMint_ = uint40(Math.max(maxMint_, _mintedTotal[saleId_])); } sale_.start = start_; sale_.finish = finish_; sale_.limit = _limit; sale_.price = _price; sale_.whitelist = whitelist_; sale_.root = root_; sale_.maxMint = maxMint_; _sales[saleId_] = sale_; emit LogSaleEdited(saleId_, start_, finish_, _limit, _price, whitelist_, root_, sale_.hasMaxMint, maxMint_); } /// @notice Withdraws any ETH sent to this contract. /// @dev Only callable by this contract's owner. /// @param to_ The address to withdraw to. /// @param amount_ The amount of ETH (in Wei) to withdraw. function withdrawEther(address to_, uint256 amount_) external onlyOwner { payable(to_).transfer(amount_); } /// Withdraws any ERC20 tokens sent to the contract. /// @dev only callable by the owner. /// @param token_ The ERC20 token to withdraw /// @param to_ The address to withdraw to. /// @param amount_ The amount to withdraw function withdrawERC20(address token_, address to_, uint256 amount_) external onlyOwner { IERC20(token_).safeTransfer(to_, amount_); } // // Public Read API // /// @notice Returns the sale data for a given sale ID. /// @param saleId_ The ID of the sale to get data for. /// @return The sale data. function getSale(uint256 saleId_) external view returns (Sale memory) { return _sales[saleId_]; } /// @notice Returns the number of sales. /// @return The number of sales. function getSalesCount() external view returns (uint256) { return _sales.length; } /// @notice Returns true if the block.timestamp is within the sale's interval. /// @param saleId_ The ID of the sale to check. /// @return True if the sale is active. function isSaleActive(uint256 saleId_) external view returns (bool) { Sale memory sale_ = _sales[saleId_]; return block.timestamp >= sale_.start && block.timestamp <= sale_.finish; } /// @notice Returns the minted amount of a user on a sale. /// @param saleId_ The ID of the sale to check. /// @param user_ The user to check. /// @return The minted amount. function getMintedAmount(uint256 saleId_, address user_) external view returns (uint256) { return _minted[saleId_][user_]; } // // Public Write API // /// @notice Sets a new total max mint supply. /// @dev Only callable by the owner. /// @param newMaxMint_ The new max mint supply. function setMaxMint(uint256 newMaxMint_) public onlyOwner { uint256 oldMaxMint = maxMint; if (newMaxMint_ == oldMaxMint) revert StaleMaxMintUpdateError(); // bound max mint to next max mint - 1, so that maxMint is never lower than nextToMint id if (newMaxMint_ < oldMaxMint) { newMaxMint_ = Math.max(newMaxMint_, nextToMint - 1); } maxMint = newMaxMint_; emit LogSetMaxMint(oldMaxMint, newMaxMint_); } /// @notice Mints an NFT quantity to anyone who pays for it /// @param saleId_ The ID of the sale to mint from /// @param user_ The user to mint to /// @param quantity_ The quantity of NFTs to mint /// @param proof_ Zero for public sales function publicSaleMint(uint256 saleId_, address user_, uint256 quantity_, bytes32[] calldata proof_) external payable { _saleMint(saleId_, user_, 0, quantity_, proof_); } /// @notice Users can mint a quantity bounded by the number of apartments they bought. /// @param saleId_ The ID of the sale to mint from. /// @param user_ The user to mint to. /// @param userAllowanceFromApartmentMints_ The number of apartments the user bought. /// @param quantity_ The quantity of NFTs to mint. /// @param proof_ The proof of the user's whitelisting. function whitelistSaleMint( uint256 saleId_, address user_, uint256 userAllowanceFromApartmentMints_, uint256 quantity_, bytes32[] calldata proof_ ) external payable { _saleMint(saleId_, user_, userAllowanceFromApartmentMints_, quantity_, proof_); } /** * @notice Mints NFTs to a list of users * @dev Only callable by the owner * @param users_ The list of users to mint to * @param quantities_ The list of quantities to mint */ function ownerMint(address[] calldata users_, uint256[] calldata quantities_) external onlyOwner { if (users_.length == 0) revert ZeroUsersToMintError(); if (users_.length != quantities_.length) revert AddressessAmountsLengthsMismatchError(); // validate total mint limit uint256 mintedBefore_ = nextToMint; // mint NFTs uint256 mintedOnThisCall_; for (uint256 i_; i_ < users_.length;) { if (users_[i_] == address(0)) revert ZeroAddressError(); if (quantities_[i_] == 0) revert ZeroMintQuantityError(); for (uint256 j_; j_ < quantities_[i_];) { _mint(users_[i_], mintedBefore_ + mintedOnThisCall_); unchecked { ++mintedOnThisCall_; ++j_; } } unchecked { ++i_; } } // update nextToMint nextToMint = mintedBefore_ + mintedOnThisCall_; // update maxMint if needed - maxMint is the maximum tokenId that can be minted if (mintedBefore_ + mintedOnThisCall_ - 1 > maxMint) maxMint = mintedBefore_ + mintedOnThisCall_ - 1; // emit event emit LogOwnerMint(users_, quantities_); } function _saleMint( uint256 saleId_, address user_, uint256 userAllowanceFromApartmentMints_, uint256 quantity_, bytes32[] calldata proof_ ) internal { // check if sale is registered and quantity is grater than zero if (saleId_ >= _sales.length) revert SaleNotFoundError(saleId_); if (quantity_ == 0) revert ZeroMintQuantityError(); if (user_ == address(0)) revert ZeroAddressError(); Sale memory sale_ = _sales[saleId_]; if (block.timestamp < sale_.start || block.timestamp > sale_.finish) { revert NotInSalePhaseError(saleId_, sale_.start, sale_.finish, block.timestamp); } // validate whitelist if (sale_.whitelist) { bytes32 leaf = keccak256(abi.encodePacked(user_, userAllowanceFromApartmentMints_)); if (!_verify(sale_.root, proof_, leaf)) { revert UserNotWhitelistedOrWrongProofError(saleId_, user_, proof_); } } // validate ETH amount send to contract if (msg.value != quantity_ * sale_.price) { revert WrongValueSentForMintError(saleId_, msg.value, sale_.price, quantity_); } // validate individual mint limit uint256 limit = sale_.whitelist ? userAllowanceFromApartmentMints_ : sale_.limit; if (limit - _minted[saleId_][user_] < quantity_) { revert MaximumSaleLimitReachedError(saleId_, user_, limit); } // validate total mint limit uint256 mintedBefore = nextToMint; uint256 availableTotal_ = 1 + maxMint - mintedBefore; if (availableTotal_ == 0) { revert MaximumTotalMintSupplyReachedError(); } // bound the quantity to mint and increase mint count uint256 quantityToMint_ = Math.min(availableTotal_, quantity_); if (sale_.hasMaxMint) { // validate max sale mint limit uint256 availableSale = sale_.maxMint - _mintedTotal[saleId_]; if (availableSale == 0) { revert MaximumSaleMintSupplyReachedError(saleId_); } quantityToMint_ = Math.min(availableSale, quantityToMint_); _mintedTotal[saleId_] += quantityToMint_; } _minted[saleId_][user_] += quantityToMint_; nextToMint += quantityToMint_; // mint NFTs for (uint256 i; i < quantityToMint_;) { _mint(user_, mintedBefore + i); unchecked { ++i; } } // emit sale event emit LogSale(saleId_, user_, quantityToMint_); // refund leftover eth to buyer if (quantityToMint_ < quantity_) { // can fail when minting through a contract payable(msg.sender).transfer(sale_.price * (quantity_ - quantityToMint_)); emit LogRefund(saleId_, msg.sender, quantity_ - quantityToMint_); } } // // Internal // function _validateSaleParams( uint64 start_, uint64 finish_, bool whitelist_, bytes32 root_, bool hasMaxMint_, uint40 maxMint_ ) internal pure { if (start_ > finish_) revert InvalidSaleIntervalError(start_, finish_); if (whitelist_ && root_ == bytes32(0)) revert InvalidWhitelistRootError(); if (hasMaxMint_ && maxMint_ == 0) revert InvalidSaleMaxMintError(); } /// @notice Internal merkle proof verification. /// @dev Verify that `proof` is valid and `leaf` occurs in the merkle tree with root hash `merkleRoot`. /// @param root_ The Merkle Tree Root to be used for verification /// @param proof_ The merkle proof. /// @param leaf_ The leaf node to find. function _verify(bytes32 root_, bytes32[] calldata proof_, bytes32 leaf_) internal pure returns (bool verified) { verified = proof_.verify(root_, leaf_); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract 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. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling 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); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface 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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to * 0 before setting it to a non-zero value. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.2) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract 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; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * 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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface 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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // 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 * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [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://consensys.net/diligence/blog/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); } } }
// 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; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; import "./math/SignedMath.sol"; /** * @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 `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value)))); } /** * @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); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Tree proofs. * * The tree and the proofs can be generated using our * https://github.com/OpenZeppelin/merkle-tree[JavaScript library]. * You will find a quickstart guide in the readme. * * WARNING: You should avoid using leaf values that are 64 bytes long prior to * hashing, or use a hash function other than keccak256 for hashing leaves. * This is because the concatenation of a sorted pair of internal nodes in * the merkle tree could be reinterpreted as a leaf value. * OpenZeppelin's JavaScript library generates merkle trees that are safe * against this attack out of the box. */ library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Calldata version of {verify} * * _Available since v4.7._ */ function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { return processProofCalldata(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. * * _Available since v4.4._ */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Calldata version of {processProof} * * _Available since v4.7._ */ function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _Available since v4.7._ */ function multiProofVerify( bytes32[] memory proof, bool[] memory proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProof(proof, proofFlags, leaves) == root; } /** * @dev Calldata version of {multiProofVerify} * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _Available since v4.7._ */ function multiProofVerifyCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProofCalldata(proof, proofFlags, leaves) == root; } /** * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false * respectively. * * CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer). * * _Available since v4.7._ */ function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]) : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { unchecked { return hashes[totalHashes - 1]; } } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Calldata version of {processMultiProof}. * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _Available since v4.7._ */ function processMultiProofCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]) : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { unchecked { return hashes[totalHashes - 1]; } } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) { return a < b ? _efficientHash(a, b) : _efficientHash(b, a); } function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) { /// @solidity memory-safe-assembly assembly { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // 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) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 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 256, 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 << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import "./ILayerZeroUserApplicationConfig.sol"; interface ILayerZeroEndpoint is ILayerZeroUserApplicationConfig { // @notice send a LayerZero message to the specified address at a LayerZero endpoint. // @param _dstChainId - the destination chain identifier // @param _destination - the address on destination chain (in bytes). address length/format may vary by chains // @param _payload - a custom bytes payload to send to the destination contract // @param _refundAddress - if the source transaction is cheaper than the amount of value passed, refund the additional amount to this address // @param _zroPaymentAddress - the address of the ZRO token holder who would pay for the transaction // @param _adapterParams - parameters for custom functionality. e.g. receive airdropped native gas from the relayer on destination function send( uint16 _dstChainId, bytes calldata _destination, bytes calldata _payload, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams ) external payable; // @notice used by the messaging library to publish verified payload // @param _srcChainId - the source chain identifier // @param _srcAddress - the source contract (as bytes) at the source chain // @param _dstAddress - the address on destination chain // @param _nonce - the unbound message ordering nonce // @param _gasLimit - the gas limit for external contract execution // @param _payload - verified payload to send to the destination contract function receivePayload( uint16 _srcChainId, bytes calldata _srcAddress, address _dstAddress, uint64 _nonce, uint256 _gasLimit, bytes calldata _payload ) external; // @notice get the inboundNonce of a lzApp from a source chain which could be EVM or non-EVM chain // @param _srcChainId - the source chain identifier // @param _srcAddress - the source chain contract address function getInboundNonce(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (uint64); // @notice get the outboundNonce from this source chain which, consequently, is always an EVM // @param _srcAddress - the source chain contract address function getOutboundNonce(uint16 _dstChainId, address _srcAddress) external view returns (uint64); // @notice gets a quote in source native gas, for the amount that send() requires to pay for message delivery // @param _dstChainId - the destination chain identifier // @param _userApplication - the user app address on this EVM chain // @param _payload - the custom message to send over LayerZero // @param _payInZRO - if false, user app pays the protocol fee in native token // @param _adapterParam - parameters for the adapter service, e.g. send some dust native token to dstChain function estimateFees( uint16 _dstChainId, address _userApplication, bytes calldata _payload, bool _payInZRO, bytes calldata _adapterParam ) external view returns (uint256 nativeFee, uint256 zroFee); // @notice get this Endpoint's immutable source identifier function getChainId() external view returns (uint16); // @notice the interface to retry failed message on this Endpoint destination // @param _srcChainId - the source chain identifier // @param _srcAddress - the source chain contract address // @param _payload - the payload to be retried function retryPayload(uint16 _srcChainId, bytes calldata _srcAddress, bytes calldata _payload) external; // @notice query if any STORED payload (message blocking) at the endpoint. // @param _srcChainId - the source chain identifier // @param _srcAddress - the source chain contract address function hasStoredPayload(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool); // @notice query if the _libraryAddress is valid for sending msgs. // @param _userApplication - the user app address on this EVM chain function getSendLibraryAddress(address _userApplication) external view returns (address); // @notice query if the _libraryAddress is valid for receiving msgs. // @param _userApplication - the user app address on this EVM chain function getReceiveLibraryAddress(address _userApplication) external view returns (address); // @notice query if the non-reentrancy guard for send() is on // @return true if the guard is on. false otherwise function isSendingPayload() external view returns (bool); // @notice query if the non-reentrancy guard for receive() is on // @return true if the guard is on. false otherwise function isReceivingPayload() external view returns (bool); // @notice get the configuration of the LayerZero messaging library of the specified version // @param _version - messaging library version // @param _chainId - the chainId for the pending config change // @param _userApplication - the contract address of the user application // @param _configType - type of configuration. every messaging library has its own convention. function getConfig(uint16 _version, uint16 _chainId, address _userApplication, uint256 _configType) external view returns (bytes memory); // @notice get the send() LayerZero messaging library version // @param _userApplication - the contract address of the user application function getSendVersion(address _userApplication) external view returns (uint16); // @notice get the lzReceive() LayerZero messaging library version // @param _userApplication - the contract address of the user application function getReceiveVersion(address _userApplication) external view returns (uint16); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; interface ILayerZeroReceiver { // @notice LayerZero endpoint will invoke this function to deliver the message on the destination // @param _srcChainId - the source endpoint identifier // @param _srcAddress - the source sending contract address from the source chain // @param _nonce - the ordered message nonce // @param _payload - the signed payload is the UA bytes has encoded to be sent function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; interface ILayerZeroUserApplicationConfig { // @notice set the configuration of the LayerZero messaging library of the specified version // @param _version - messaging library version // @param _chainId - the chainId for the pending config change // @param _configType - type of configuration. every messaging library has its own convention. // @param _config - configuration in the bytes. can encode arbitrary content. function setConfig(uint16 _version, uint16 _chainId, uint256 _configType, bytes calldata _config) external; // @notice set the send() LayerZero messaging library version to _version // @param _version - new messaging library version function setSendVersion(uint16 _version) external; // @notice set the lzReceive() LayerZero messaging library version to _version // @param _version - new messaging library version function setReceiveVersion(uint16 _version) external; // @notice Only when the UA needs to resume the message flow in blocking mode and clear the stored payload // @param _srcChainId - the chainId of the source chain // @param _srcAddress - the contract address of the source contract at the source chain function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IONFT721Core.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; /** * @dev Interface of the ONFT standard */ interface IONFT721 is IONFT721Core, IERC721 { }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; /** * @dev Interface of the ONFT Core standard */ interface IONFT721Core is IERC165 { /** * @dev estimate send token `_tokenId` to (`_dstChainId`, `_toAddress`) * _dstChainId - L0 defined chain id to send tokens too * _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain * _tokenId - token Id to transfer * _useZro - indicates to use zro to pay L0 fees * _adapterParams - flexible bytes array to indicate messaging adapter services in L0 */ function estimateSendFee( uint16 _dstChainId, bytes calldata _toAddress, uint256 _tokenId, bool _useZro, bytes calldata _adapterParams ) external view returns (uint256 nativeFee, uint256 zroFee); /** * @dev send token `_tokenId` to (`_dstChainId`, `_toAddress`) from `_from` * `_toAddress` can be any size depending on the `dstChainId`. * `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token) * `_adapterParams` is a flexible bytes array to indicate messaging adapter services */ function send( uint16 _dstChainId, bytes calldata _toAddress, uint256 _tokenId, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams ) external payable; /** * @dev Emitted when `_tokenId` are moved from the `_sender` to (`_dstChainId`, `_toAddress`) * `_nonce` is the outbound nonce from */ event SendToChain( address indexed _sender, uint16 indexed _dstChainId, bytes indexed _toAddress, uint256 _tokenId, uint64 _nonce ); /** * @dev Emitted when `_tokenId` are sent from `_srcChainId` to the `_toAddress` at this chain. `_nonce` is the inbound nonce. */ event ReceiveFromChain( uint16 indexed _srcChainId, bytes indexed _srcAddress, address indexed _toAddress, uint256 _tokenId, uint64 _nonce ); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "../interfaces/ILayerZeroReceiver.sol"; import "../interfaces/ILayerZeroUserApplicationConfig.sol"; import "../interfaces/ILayerZeroEndpoint.sol"; /* * a generic LzReceiver implementation */ abstract contract LzApp is Ownable, ILayerZeroReceiver, ILayerZeroUserApplicationConfig { ILayerZeroEndpoint public immutable lzEndpoint; mapping(uint16 => bytes) public trustedRemoteLookup; event SetTrustedRemote(uint16 _srcChainId, bytes _srcAddress); constructor(address _endpoint) { lzEndpoint = ILayerZeroEndpoint(_endpoint); } function lzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) public virtual override { // lzReceive must be called by the endpoint for security require(_msgSender() == address(lzEndpoint), "LzReceiver: !endpoint"); bytes memory trustedRemote = trustedRemoteLookup[_srcChainId]; // if will still block the message pathway from (srcChainId, srcAddress). should not receive message from untrusted remote. require( _srcAddress.length == trustedRemote.length && keccak256(_srcAddress) == keccak256(trustedRemote), "LzReceiver: invalid source" ); _blockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload); } // abstract function - the default behaviour of LayerZero is blocking. See: NonblockingLzApp if you dont need to enforce ordered messaging function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual; function _lzSend( uint16 _dstChainId, bytes memory _payload, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams ) internal virtual { bytes memory trustedRemote = trustedRemoteLookup[_dstChainId]; require(trustedRemote.length != 0, "LzSend: !trusted source."); lzEndpoint.send{ value: msg.value }( _dstChainId, trustedRemote, _payload, _refundAddress, _zroPaymentAddress, _adapterParams ); } //---------------------------UserApplication config---------------------------------------- function getConfig(uint16 _version, uint16 _chainId, address, uint256 _configType) external view returns (bytes memory) { return lzEndpoint.getConfig(_version, _chainId, address(this), _configType); } // generic config for LayerZero user Application function setConfig(uint16 _version, uint16 _chainId, uint256 _configType, bytes calldata _config) external override onlyOwner { lzEndpoint.setConfig(_version, _chainId, _configType, _config); } function setSendVersion(uint16 _version) external override onlyOwner { lzEndpoint.setSendVersion(_version); } function setReceiveVersion(uint16 _version) external override onlyOwner { lzEndpoint.setReceiveVersion(_version); } function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external override onlyOwner { lzEndpoint.forceResumeReceive(_srcChainId, _srcAddress); } // allow owner to set it multiple times. function setTrustedRemote(uint16 _srcChainId, bytes calldata _srcAddress) external onlyOwner { trustedRemoteLookup[_srcChainId] = _srcAddress; emit SetTrustedRemote(_srcChainId, _srcAddress); } //--------------------------- VIEW FUNCTION ---------------------------------------- function isTrustedRemote(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool) { bytes memory trustedSource = trustedRemoteLookup[_srcChainId]; return keccak256(trustedSource) == keccak256(_srcAddress); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./LzApp.sol"; /* * the default LayerZero messaging behaviour is blocking, i.e. any failed message will block the channel * this abstract class try-catch all fail messages and store locally for future retry. hence, non-blocking * NOTE: if the srcAddress is not configured properly, it will still block the message pathway from (srcChainId, srcAddress) */ abstract contract NonblockingLzApp is LzApp { constructor(address _endpoint) LzApp(_endpoint) { } mapping(uint16 => mapping(bytes => mapping(uint64 => bytes32))) public failedMessages; event MessageFailed(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes _payload); // overriding the virtual function in LzReceiver function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual override { // try-catch all errors/exceptions try this.nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload) { // do nothing } catch { // error / exception failedMessages[_srcChainId][_srcAddress][_nonce] = keccak256(_payload); emit MessageFailed(_srcChainId, _srcAddress, _nonce, _payload); } } function nonblockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) public virtual { // only internal transaction require(_msgSender() == address(this), "LzReceiver: caller must be LzApp"); _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload); } //@notice override this function function _nonblockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual; function retryMessage(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes calldata _payload) public payable virtual { // assert there is message to retry bytes32 payloadHash = failedMessages[_srcChainId][_srcAddress][_nonce]; require(payloadHash != bytes32(0), "LzReceiver: no stored message"); require(keccak256(_payload) == payloadHash, "LzReceiver: invalid payload"); // clear the stored message failedMessages[_srcChainId][_srcAddress][_nonce] = bytes32(0); // execute the message. revert if it fails again _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../interfaces/IONFT721.sol"; import "./ONFT721Core.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; // NOTE: this ONFT contract has no public minting logic. // must implement your own minting logic in child classes contract ONFT721 is ONFT721Core, ERC721, IERC721Receiver, IONFT721 { constructor(string memory _name, string memory _symbol, address _lzEndpoint) ERC721(_name, _symbol) ONFT721Core(_lzEndpoint) { } function supportsInterface(bytes4 interfaceId) public view virtual override(ONFT721Core, ERC721, IERC165) returns (bool) { return interfaceId == type(IONFT721).interfaceId || super.supportsInterface(interfaceId); } function _debitFrom(address _from, uint16, bytes memory, uint256 _tokenId) internal virtual override { require(_isApprovedOrOwner(_msgSender(), _tokenId), "ONFT721: not owner nor approved"); require(ERC721.ownerOf(_tokenId) == _from, "ONFT721: incorrect owner"); _burn(_tokenId); } function _creditTo(uint16, address _toAddress, uint256 _tokenId) internal virtual override { _safeMint(_toAddress, _tokenId); } function onERC721Received(address _operator, address, uint256, bytes memory) public virtual override returns (bytes4) { // only allow `this` to tranfser token from others if (_operator != address(this)) return bytes4(0); return IERC721Receiver.onERC721Received.selector; } /// @notice Checks if there is a payload waiting to be delivered. function hasStoredPayload(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool) { return lzEndpoint.hasStoredPayload(_srcChainId, _srcAddress); } /// @notice Retries to send a payload in case an error occurs on receiving chain. /// @dev In case an error occurs on receiving chain, the message is stuck in the pipeline until this function is called. /// Reason for message failing once contracts are stet up correctly is usually running out of gas. /// retry this message with a higher amount of gas. /// Info on retriving stored payload: https://layerzero.gitbook.io/docs/guides/error-messages/storedpayload-detection /// @param _srcChainId The source chain ID /// @param _srcAddress The source address /// @param _payload Message payload. THis can be retrieved from etherscan: function retryPayload(uint16 _srcChainId, bytes calldata _srcAddress, bytes calldata _payload) external payable { lzEndpoint.retryPayload(_srcChainId, _srcAddress, _payload); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../interfaces/IONFT721Core.sol"; import "../../lzApp/NonblockingLzApp.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; abstract contract ONFT721Core is NonblockingLzApp, ERC165, IONFT721Core { constructor(address _lzEndpoint) NonblockingLzApp(_lzEndpoint) { } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IONFT721Core).interfaceId || super.supportsInterface(interfaceId); } function estimateSendFee( uint16 _dstChainId, bytes memory _toAddress, uint256 _tokenId, bool _useZro, bytes memory _adapterParams ) public view virtual override returns (uint256 nativeFee, uint256 zroFee) { // mock the payload for send() bytes memory payload = abi.encode(_toAddress, _tokenId); return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams); } function send( uint16 _dstChainId, bytes memory _toAddress, uint256 _tokenId, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams ) public payable virtual override { _send(msg.sender, _dstChainId, _toAddress, _tokenId, _refundAddress, _zroPaymentAddress, _adapterParams); } function _send( address _from, uint16 _dstChainId, bytes memory _toAddress, uint256 _tokenId, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams ) internal virtual { _debitFrom(_from, _dstChainId, _toAddress, _tokenId); bytes memory payload = abi.encode(_toAddress, _tokenId); _lzSend(_dstChainId, payload, _refundAddress, _zroPaymentAddress, _adapterParams); uint64 nonce = lzEndpoint.getOutboundNonce(_dstChainId, address(this)); emit SendToChain(_from, _dstChainId, _toAddress, _tokenId, nonce); } function _nonblockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual override { // decode and load the toAddress (bytes memory toAddressBytes, uint256 tokenId) = abi.decode(_payload, (bytes, uint256)); address toAddress; assembly { toAddress := mload(add(toAddressBytes, 20)) } _creditTo(_srcChainId, toAddress, tokenId); emit ReceiveFromChain(_srcChainId, _srcAddress, toAddress, tokenId, _nonce); } function _debitFrom(address _from, uint16 _dstChainId, bytes memory _toAddress, uint256 _tokenId) internal virtual; function _creditTo(uint16 _srcChainId, address _toAddress, uint256 _tokenId) internal virtual; }
{ "remappings": [ "@forge-std/=lib/forge-std/src/", "@openzeppelin/=lib/openzeppelin-contracts/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "bytecodeHash": "ipfs" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"address","name":"lzEndpoint_","type":"address"},{"internalType":"string","name":"initialURI_","type":"string"},{"internalType":"uint256","name":"maxMint_","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AddressessAmountsLengthsMismatchError","type":"error"},{"inputs":[{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"finish","type":"uint256"}],"name":"InvalidSaleIntervalError","type":"error"},{"inputs":[],"name":"InvalidSaleMaxMintError","type":"error"},{"inputs":[],"name":"InvalidWhitelistRootError","type":"error"},{"inputs":[{"internalType":"uint256","name":"saleId","type":"uint256"},{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"limit","type":"uint256"}],"name":"MaximumSaleLimitReachedError","type":"error"},{"inputs":[{"internalType":"uint256","name":"saleId","type":"uint256"}],"name":"MaximumSaleMintSupplyReachedError","type":"error"},{"inputs":[],"name":"MaximumTotalMintSupplyReachedError","type":"error"},{"inputs":[{"internalType":"uint256","name":"saleId","type":"uint256"},{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"finish","type":"uint256"},{"internalType":"uint256","name":"current","type":"uint256"}],"name":"NotInSalePhaseError","type":"error"},{"inputs":[{"internalType":"uint256","name":"saleId","type":"uint256"}],"name":"SaleNotFoundError","type":"error"},{"inputs":[],"name":"StaleMaxMintUpdateError","type":"error"},{"inputs":[{"internalType":"uint256","name":"saleId","type":"uint256"},{"internalType":"address","name":"user","type":"address"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"UserNotWhitelistedOrWrongProofError","type":"error"},{"inputs":[{"internalType":"uint256","name":"saleId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"WrongValueSentForMintError","type":"error"},{"inputs":[],"name":"ZeroAddressError","type":"error"},{"inputs":[],"name":"ZeroMintQuantityError","type":"error"},{"inputs":[],"name":"ZeroUsersToMintError","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"users","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"LogOwnerMint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"saleId","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"LogRefund","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"saleId","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"LogSale","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"saleId","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"start","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"finish","type":"uint64"},{"indexed":false,"internalType":"uint8","name":"limit","type":"uint8"},{"indexed":false,"internalType":"uint64","name":"price","type":"uint64"},{"indexed":false,"internalType":"bool","name":"whitelist","type":"bool"},{"indexed":false,"internalType":"bytes32","name":"root","type":"bytes32"},{"indexed":false,"internalType":"bool","name":"hasMaxMint","type":"bool"},{"indexed":false,"internalType":"uint40","name":"maxMint","type":"uint40"}],"name":"LogSaleCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"saleId","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"start","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"finish","type":"uint64"},{"indexed":false,"internalType":"uint8","name":"limit","type":"uint8"},{"indexed":false,"internalType":"uint64","name":"price","type":"uint64"},{"indexed":false,"internalType":"bool","name":"whitelist","type":"bool"},{"indexed":false,"internalType":"bytes32","name":"root","type":"bytes32"},{"indexed":false,"internalType":"bool","name":"hasMaxMint","type":"bool"},{"indexed":false,"internalType":"uint40","name":"maxMint","type":"uint40"}],"name":"LogSaleEdited","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"prevMaxMint","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newMaxMint","type":"uint256"}],"name":"LogSetMaxMint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"newURI","type":"string"}],"name":"LogSetURI","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"indexed":false,"internalType":"uint64","name":"_nonce","type":"uint64"},{"indexed":false,"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"MessageFailed","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":"uint16","name":"_srcChainId","type":"uint16"},{"indexed":true,"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"indexed":true,"internalType":"address","name":"_toAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"_nonce","type":"uint64"}],"name":"ReceiveFromChain","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_sender","type":"address"},{"indexed":true,"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"indexed":true,"internalType":"bytes","name":"_toAddress","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"_nonce","type":"uint64"}],"name":"SendToChain","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_srcAddress","type":"bytes"}],"name":"SetTrustedRemote","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"uint64","name":"start_","type":"uint64"},{"internalType":"uint64","name":"finish_","type":"uint64"},{"internalType":"uint8","name":"_limit","type":"uint8"},{"internalType":"uint64","name":"_price","type":"uint64"},{"internalType":"bool","name":"whitelist_","type":"bool"},{"internalType":"bytes32","name":"root_","type":"bytes32"},{"internalType":"bool","name":"hasMaxMint_","type":"bool"},{"internalType":"uint40","name":"maxMint_","type":"uint40"}],"name":"addSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"saleId_","type":"uint256"},{"internalType":"uint64","name":"start_","type":"uint64"},{"internalType":"uint64","name":"finish_","type":"uint64"},{"internalType":"uint8","name":"_limit","type":"uint8"},{"internalType":"uint64","name":"_price","type":"uint64"},{"internalType":"bool","name":"whitelist_","type":"bool"},{"internalType":"bytes32","name":"root_","type":"bytes32"},{"internalType":"uint40","name":"maxMint_","type":"uint40"}],"name":"editSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes","name":"_toAddress","type":"bytes"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"bool","name":"_useZro","type":"bool"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"}],"name":"estimateSendFee","outputs":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"zroFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"bytes","name":"","type":"bytes"},{"internalType":"uint64","name":"","type":"uint64"}],"name":"failedMessages","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"}],"name":"forceResumeReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"},{"internalType":"uint16","name":"_chainId","type":"uint16"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"_configType","type":"uint256"}],"name":"getConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"saleId_","type":"uint256"},{"internalType":"address","name":"user_","type":"address"}],"name":"getMintedAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"saleId_","type":"uint256"}],"name":"getSale","outputs":[{"components":[{"internalType":"bytes32","name":"root","type":"bytes32"},{"internalType":"bool","name":"whitelist","type":"bool"},{"internalType":"uint64","name":"start","type":"uint64"},{"internalType":"uint64","name":"finish","type":"uint64"},{"internalType":"uint64","name":"price","type":"uint64"},{"internalType":"uint8","name":"limit","type":"uint8"},{"internalType":"bool","name":"hasMaxMint","type":"bool"},{"internalType":"uint40","name":"maxMint","type":"uint40"}],"internalType":"struct DefimonsStarterMonsters.Sale","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSalesCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"}],"name":"hasStoredPayload","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"saleId_","type":"uint256"}],"name":"isSaleActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"}],"name":"isTrustedRemote","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lzEndpoint","outputs":[{"internalType":"contract ILayerZeroEndpoint","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"lzReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maxMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextToMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"nonblockingLzReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_operator","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"users_","type":"address[]"},{"internalType":"uint256[]","name":"quantities_","type":"uint256[]"}],"name":"ownerMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"saleId_","type":"uint256"},{"internalType":"address","name":"user_","type":"address"},{"internalType":"uint256","name":"quantity_","type":"uint256"},{"internalType":"bytes32[]","name":"proof_","type":"bytes32[]"}],"name":"publicSaleMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"retryMessage","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"retryPayload","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes","name":"_toAddress","type":"bytes"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address payable","name":"_refundAddress","type":"address"},{"internalType":"address","name":"_zroPaymentAddress","type":"address"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"}],"name":"send","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"},{"internalType":"uint16","name":"_chainId","type":"uint16"},{"internalType":"uint256","name":"_configType","type":"uint256"},{"internalType":"bytes","name":"_config","type":"bytes"}],"name":"setConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newMaxMint_","type":"uint256"}],"name":"setMaxMint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"}],"name":"setReceiveVersion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"}],"name":"setSendVersion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"}],"name":"setTrustedRemote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newURI_","type":"string"}],"name":"setURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"}],"name":"trustedRemoteLookup","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"saleId_","type":"uint256"},{"internalType":"address","name":"user_","type":"address"},{"internalType":"uint256","name":"userAllowanceFromApartmentMints_","type":"uint256"},{"internalType":"uint256","name":"quantity_","type":"uint256"},{"internalType":"bytes32[]","name":"proof_","type":"bytes32[]"}],"name":"whitelistSaleMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token_","type":"address"},{"internalType":"address","name":"to_","type":"address"},{"internalType":"uint256","name":"amount_","type":"uint256"}],"name":"withdrawERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to_","type":"address"},{"internalType":"uint256","name":"amount_","type":"uint256"}],"name":"withdrawEther","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60a06040526001600b553480156200001657600080fd5b506040516200523e3803806200523e8339810160408190526200003991620003fc565b84848482828280806200004c33620000b2565b6001600160a01b0316608052505081516200006f9060039060208501906200027c565b508051620000859060049060208401906200027c565b5050505050506200009c826200010260201b60201c565b620000a7816200015e565b505050505062000550565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6200010c62000201565b80516200012190600a9060208401906200027c565b507f71cabd649e93e2aa1fae6b5fa734ff133e12a99dc1c56024d99ee03072ef473081604051620001539190620004b9565b60405180910390a150565b6200016862000201565b6009548082036200018c5760405163147038e560e11b815260040160405180910390fd5b80821015620001bf57620001bc826001600b54620001ab9190620004ee565b6200026260201b620021891760201c565b91505b600982905560408051828152602081018490527f4057d55d57d7c3455178f70f11ab64978cb4ba22d8735c2ddd2025a98f7aea78910160405180910390a15050565b6000546001600160a01b03163314620002605760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640160405180910390fd5b565b600081831162000273578162000275565b825b9392505050565b8280546200028a9062000514565b90600052602060002090601f016020900481019282620002ae5760008555620002f9565b82601f10620002c957805160ff1916838001178555620002f9565b82800160010185558215620002f9579182015b82811115620002f9578251825591602001919060010190620002dc565b50620003079291506200030b565b5090565b5b808211156200030757600081556001016200030c565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620003555781810151838201526020016200033b565b8381111562000365576000848401525b50505050565b600082601f8301126200037d57600080fd5b81516001600160401b03808211156200039a576200039a62000322565b604051601f8301601f19908116603f01168101908282118183101715620003c557620003c562000322565b81604052838152866020858801011115620003df57600080fd5b620003f284602083016020890162000338565b9695505050505050565b600080600080600060a086880312156200041557600080fd5b85516001600160401b03808211156200042d57600080fd5b6200043b89838a016200036b565b965060208801519150808211156200045257600080fd5b6200046089838a016200036b565b604089015190965091506001600160a01b03821682146200048057600080fd5b6060880151919450808211156200049657600080fd5b50620004a5888289016200036b565b925050608086015190509295509295909350565b6020815260008251806020840152620004da81604085016020870162000338565b601f01601f19169190910160400192915050565b6000828210156200050f57634e487b7160e01b600052601160045260246000fd5b500390565b600181811c908216806200052957607f821691505b6020821081036200054a57634e487b7160e01b600052602260045260246000fd5b50919050565b608051614c85620005b9600039600081816107d00152818161096601528181610c1f01528181610dd601528181610e790152818161102e015281816114a401528181611bfa01528181611d27015281816121090152818161305601526136460152614c856000f3fe6080604052600436106102ad5760003560e01c806366ad5c8a11610175578063aaff5f16116100dc578063d8f6d59611610095578063eb8d72b71161006f578063eb8d72b7146108f0578063eed33cef14610910578063f2fde38b14610923578063f5ecbdbc1461094357600080fd5b8063d8f6d59614610865578063dd8027db14610892578063e985e9c5146108a757600080fd5b8063aaff5f16146107ab578063b353aaa7146107be578063b88d4fde146107f2578063c87b56dd14610812578063cbed8b9c14610832578063d1deba1f1461085257600080fd5b80637533d7881161012e5780637533d788146107055780638989ab3a146107255780638da5cb5b1461074557806395d89b41146107635780639ad4ae6c14610778578063a22cb4651461078b57600080fd5b806366ad5c8a1461066457806369f7d2f2146106845780636be78f76146106a457806370a08231146106ba578063715018a6146106da5780637501f741146106ef57600080fd5b8063285f12391161021957806344004cc1116101d257806344004cc114610544578063522f681514610564578063547520fe146105845780635b8c41e6146105a45780635d55159e146106015780636352211e1461064457600080fd5b8063285f12391461046f5780632a205e3d1461048f5780633d8b38f6146104c4578063402c67dc146104e457806342842e0e1461050457806342d65a8d1461052457600080fd5b8063095ea7b31161026b578063095ea7b3146103a35780630eaf6ea6146103c357806310ddb137146103e3578063150b7a021461040357806319c2c0221461043c57806323b872dd1461044f57600080fd5b80621d3567146102b257806301ffc9a7146102d457806302fe53051461030957806306fdde031461032957806307e0db171461034b578063081812fc1461036b575b600080fd5b3480156102be57600080fd5b506102d26102cd366004613bb4565b610963565b005b3480156102e057600080fd5b506102f46102ef366004613c52565b610af3565b60405190151581526020015b60405180910390f35b34801561031557600080fd5b506102d2610324366004613c6f565b610b16565b34801561033557600080fd5b5061033e610b6c565b6040516103009190613d0f565b34801561035757600080fd5b506102d2610366366004613d22565b610bfe565b34801561037757600080fd5b5061038b610386366004613d3d565b610c80565b6040516001600160a01b039091168152602001610300565b3480156103af57600080fd5b506102d26103be366004613d6b565b610ca7565b3480156103cf57600080fd5b506102f46103de366004613ddf565b610dbc565b3480156103ef57600080fd5b506102d26103fe366004613d22565b610e58565b34801561040f57600080fd5b5061042361041e366004613e31565b610eb0565b6040516001600160e01b03199091168152602001610300565b6102d261044a366004613ed4565b610edb565b34801561045b57600080fd5b506102d261046a366004613f3d565b610eea565b34801561047b57600080fd5b506102f461048a366004613d3d565b610f1c565b34801561049b57600080fd5b506104af6104aa366004613f8c565b610fef565b60408051928352602083019190915201610300565b3480156104d057600080fd5b506102f46104df366004613ddf565b6110ba565b3480156104f057600080fd5b506102d26104ff366004614044565b611186565b34801561051057600080fd5b506102d261051f366004613f3d565b61146a565b34801561053057600080fd5b506102d261053f366004613ddf565b611485565b34801561055057600080fd5b506102d261055f366004613f3d565b611514565b34801561057057600080fd5b506102d261057f366004613d6b565b611530565b34801561059057600080fd5b506102d261059f366004613d3d565b61156e565b3480156105b057600080fd5b506105f36105bf3660046140d5565b6002602090815260009384526040808520845180860184018051928152908401958401959095209452929052825290205481565b604051908152602001610300565b34801561060d57600080fd5b506105f361061c366004614136565b6000918252600d602090815260408084206001600160a01b0393909316845291905290205490565b34801561065057600080fd5b5061038b61065f366004613d3d565b6115fe565b34801561067057600080fd5b506102d261067f366004613bb4565b61165e565b34801561069057600080fd5b506102d261069f366004614166565b6116bf565b3480156106b057600080fd5b506105f3600b5481565b3480156106c657600080fd5b506105f36106d53660046141d1565b61189c565b3480156106e657600080fd5b506102d2611922565b3480156106fb57600080fd5b506105f360095481565b34801561071157600080fd5b5061033e610720366004613d22565b611936565b34801561073157600080fd5b506102d26107403660046141ee565b6119d0565b34801561075157600080fd5b506000546001600160a01b031661038b565b34801561076f57600080fd5b5061033e611baf565b6102d2610786366004614279565b611bbe565b34801561079757600080fd5b506102d26107a63660046142eb565b611bd4565b6102d26107b9366004614319565b611be3565b3480156107ca57600080fd5b5061038b7f000000000000000000000000000000000000000000000000000000000000000081565b3480156107fe57600080fd5b506102d261080d366004613e31565b611c70565b34801561081e57600080fd5b5061033e61082d366004613d3d565b611ca2565b34801561083e57600080fd5b506102d261084d366004614388565b611d08565b6102d26108603660046143e5565b611d64565b34801561087157600080fd5b50610885610880366004613d3d565b611ef7565b6040516103009190614456565b34801561089e57600080fd5b50600c546105f3565b3480156108b357600080fd5b506102f46108c23660046144de565b6001600160a01b03918216600090815260086020908152604080832093909416825291909152205460ff1690565b3480156108fc57600080fd5b506102d261090b366004613ddf565b611fe9565b6102d261091e36600461450c565b612050565b34801561092f57600080fd5b506102d261093e3660046141d1565b61205f565b34801561094f57600080fd5b5061033e61095e3660046145b1565b6120d8565b337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316146109d85760405162461bcd60e51b8152602060048201526015602482015274131e949958d95a5d995c8e8808595b991c1bda5b9d605a1b60448201526064015b60405180910390fd5b61ffff8416600090815260016020526040812080546109f6906145fe565b80601f0160208091040260200160405190810160405280929190818152602001828054610a22906145fe565b8015610a6f5780601f10610a4457610100808354040283529160200191610a6f565b820191906000526020600020905b815481529060010190602001808311610a5257829003601f168201915b5050505050905080518451148015610a94575080805190602001208480519060200120145b610ae05760405162461bcd60e51b815260206004820152601a60248201527f4c7a52656365697665723a20696e76616c696420736f7572636500000000000060448201526064016109cf565b610aec8585858561219f565b5050505050565b60006001600160e01b031982161580610b105750610b1082612290565b92915050565b610b1e6122d0565b8051610b3190600a9060208401906139b0565b507f71cabd649e93e2aa1fae6b5fa734ff133e12a99dc1c56024d99ee03072ef473081604051610b619190613d0f565b60405180910390a150565b606060038054610b7b906145fe565b80601f0160208091040260200160405190810160405280929190818152602001828054610ba7906145fe565b8015610bf45780601f10610bc957610100808354040283529160200191610bf4565b820191906000526020600020905b815481529060010190602001808311610bd757829003601f168201915b5050505050905090565b610c066122d0565b6040516307e0db1760e01b815261ffff821660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906307e0db17906024015b600060405180830381600087803b158015610c6c57600080fd5b505af1158015610aec573d6000803e3d6000fd5b6000610c8b8261232a565b506000908152600760205260409020546001600160a01b031690565b6000610cb2826115fe565b9050806001600160a01b0316836001600160a01b031603610d1f5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016109cf565b336001600160a01b0382161480610d3b5750610d3b81336108c2565b610dad5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c00000060648201526084016109cf565b610db78383612389565b505050565b604051630757b75360e11b81526000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690630eaf6ea690610e0f90879087908790600401614661565b602060405180830381865afa158015610e2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e50919061467f565b949350505050565b610e606122d0565b6040516310ddb13760e01b815261ffff821660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906310ddb13790602401610c52565b60006001600160a01b0385163014610eca57506000610e50565b50630a85bd0160e11b949350505050565b610aec858560008686866123f7565b610ef5335b8261290a565b610f115760405162461bcd60e51b81526004016109cf9061469c565b610db7838383612988565b600080600c8381548110610f3257610f326146e9565b6000918252602091829020604080516101008082018352600294909402909201805483526001015460ff8082161515958401959095529283046001600160401b03908116918301829052600160481b840481166060840152600160881b8404166080830152600160c81b8304841660a0830152600160d01b8304909316151560c0820152600160d81b90910464ffffffffff1660e082015291504210801590610fe8575080606001516001600160401b03164211155b9392505050565b600080600086866040516020016110079291906146ff565b60408051601f198184030181529082905263040a7bb160e41b825291506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906340a7bb109061106b908b90309086908b908b90600401614721565b6040805180830381865afa158015611087573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ab9190614775565b92509250509550959350505050565b61ffff8316600090815260016020526040812080548291906110db906145fe565b80601f0160208091040260200160405190810160405280929190818152602001828054611107906145fe565b80156111545780601f1061112957610100808354040283529160200191611154565b820191906000526020600020905b81548152906001019060200180831161113757829003601f168201915b50505050509050838360405161116b929190614799565b60405180910390208180519060200120149150509392505050565b61118e6122d0565b600c5488106111b3576040516369face4b60e01b8152600481018990526024016109cf565b6000600c89815481106111c8576111c86146e9565b6000918252602091829020604080516101008082018352600294909402909201805483526001015460ff8082161515958401959095529283046001600160401b0390811691830191909152600160481b830481166060830152600160881b8304166080820152600160c81b8204831660a0820152600160d01b8204909216151560c08301819052600160d81b90910464ffffffffff1660e083015290915061127890899089908790879087612aec565b8060c00151801561129a57508060e0015164ffffffffff168264ffffffffff16105b156112c3576000898152600e60205260409020546112c09064ffffffffff841690612189565b91505b6001600160401b038089166040830152878116606083015260ff871660a083015285166080820152831515602082015282815264ffffffffff821660e0820152600c80548291908b90811061131a5761131a6146e9565b600091825260209182902083516002929092020190815590820151600190910180546040808501516060860151608087015160a088015160c0808a015160e0909a015168ffffffffffffffffff1990971698151568ffffffffffffffff001916989098176101006001600160401b039586160217600160481b600160c81b031916600160481b9385169390930267ffffffffffffffff60881b191692909217600160881b93909116929092029190911761ffff60c81b1916600160c81b60ff9092169190910260ff60d01b191617600160d01b95151595909502949094176001600160d81b0316600160d81b64ffffffffff9092169190910217905582015190518a917fca4b9e6417d974e30473076b47f788e71d2733b1b64abdcf8fe1bf05e8df94a991611457918c918c918c918c918c918c91908c906147a9565b60405180910390a2505050505050505050565b610db783838360405180602001604052806000815250611c70565b61148d6122d0565b6040516342d65a8d60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906342d65a8d906114dd90869086908690600401614661565b600060405180830381600087803b1580156114f757600080fd5b505af115801561150b573d6000803e3d6000fd5b50505050505050565b61151c6122d0565b610db76001600160a01b0384168383612b8b565b6115386122d0565b6040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610db7573d6000803e3d6000fd5b6115766122d0565b6009548082036115995760405163147038e560e11b815260040160405180910390fd5b808210156115bc576115b9826001600b546115b49190614814565b612189565b91505b600982905560408051828152602081018490527f4057d55d57d7c3455178f70f11ab64978cb4ba22d8735c2ddd2025a98f7aea78910160405180910390a15050565b6000818152600560205260408120546001600160a01b031680610b105760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016109cf565b3330146116ad5760405162461bcd60e51b815260206004820181905260248201527f4c7a52656365697665723a2063616c6c6572206d757374206265204c7a41707060448201526064016109cf565b6116b984848484612bdd565b50505050565b6116c76122d0565b60008390036116e95760405163a9131fbf60e01b815260040160405180910390fd5b828114611709576040516323951ca360e21b815260040160405180910390fd5b600b546000805b8581101561181057600087878381811061172c5761172c6146e9565b905060200201602081019061174191906141d1565b6001600160a01b03160361176857604051633efa09af60e01b815260040160405180910390fd5b84848281811061177a5761177a6146e9565b9050602002013560000361179f5760405161b08960e51b815260040160405180910390fd5b60005b8585838181106117b4576117b46146e9565b90506020020135811015611807576117fb8888848181106117d7576117d76146e9565b90506020020160208101906117ec91906141d1565b6117f6858761482b565b612c78565b600192830192016117a2565b50600101611710565b5061181b818361482b565b600b55600954600161182d838561482b565b6118379190614814565b1115611857576001611849828461482b565b6118539190614814565b6009555b7faced0429065834f9a01f96efe0cc54bc74026a45af5045ff374b84a82027df6d8686868660405161188c9493929190614879565b60405180910390a1505050505050565b60006001600160a01b0382166119065760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b60648201526084016109cf565b506001600160a01b031660009081526006602052604090205490565b61192a6122d0565b6119346000612e03565b565b6001602052600090815260409020805461194f906145fe565b80601f016020809104026020016040519081016040528092919081815260200182805461197b906145fe565b80156119c85780601f1061199d576101008083540402835291602001916119c8565b820191906000526020600020905b8154815290600101906020018083116119ab57829003601f168201915b505050505081565b6119d86122d0565b6119e6888886868686612aec565b604080516101008082018352858252861515602083019081526001600160401b038c81169484019485528b8116606085019081528a82166080860190815260ff8d811660a088019081528a151560c0890190815264ffffffffff8b811660e08b01908152600c80546001808201835560008390528d517fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c76002909302928301559a517fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c890910180549e519951985196519551935168ffffffffffffffffff19909f1691151568ffffffffffffffff00191691909117988a16909b0297909717600160481b600160c81b031916600160481b9689169690960267ffffffffffffffff60881b191695909517600160881b93909716929092029590951761ffff60c81b1916600160c81b959092169490940260ff60d01b191617600160d01b91151591909102176001600160d81b0316600160d81b96909216959095021790915591549091611b7291614814565b7fd369d0dbe155f11a3f7fd5c7f1eb1763582e9bed3e4a93efbb84201d614506e68a8a8a8a8a8a8a8a6040516114579897969594939291906147a9565b606060048054610b7b906145fe565b611bcc8686868686866123f7565b505050505050565b611bdf338383612e53565b5050565b60405163557faf8b60e11b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063aaff5f1690611c3790889088908890889088906004016148d0565b600060405180830381600087803b158015611c5157600080fd5b505af1158015611c65573d6000803e3d6000fd5b505050505050505050565b611c7a338361290a565b611c965760405162461bcd60e51b81526004016109cf9061469c565b6116b984848484612f21565b6060611cad8261232a565b6000611cb7612f54565b90506000815111611cd75760405180602001604052806000815250610fe8565b80611ce184612f63565b604051602001611cf2929190614901565b6040516020818303038152906040529392505050565b611d106122d0565b6040516332fb62e760e21b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063cbed8b9c90611c379088908890889088908890600401614930565b61ffff85166000908152600260205260408082209051611d8590879061495e565b90815260408051602092819003830190206001600160401b03871660009081529252902054905080611df95760405162461bcd60e51b815260206004820152601d60248201527f4c7a52656365697665723a206e6f2073746f726564206d65737361676500000060448201526064016109cf565b808383604051611e0a929190614799565b604051809103902014611e5f5760405162461bcd60e51b815260206004820152601b60248201527f4c7a52656365697665723a20696e76616c6964207061796c6f6164000000000060448201526064016109cf565b61ffff86166000908152600260205260408082209051611e8090889061495e565b90815260200160405180910390206000866001600160401b03166001600160401b0316815260200190815260200160002081905550611bcc86868686868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612bdd92505050565b6040805161010081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e0810191909152600c8281548110611f4b57611f4b6146e9565b6000918252602091829020604080516101008082018352600294909402909201805483526001015460ff8082161515958401959095529283046001600160401b0390811691830191909152600160481b830481166060830152600160881b8304166080820152600160c81b8204831660a0820152600160d01b8204909216151560c0830152600160d81b900464ffffffffff1660e082015292915050565b611ff16122d0565b61ffff8316600090815260016020526040902061200f908383613a34565b507ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab83838360405161204393929190614661565b60405180910390a1505050565b611bcc33878787878787612ff5565b6120676122d0565b6001600160a01b0381166120cc5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016109cf565b6120d581612e03565b50565b604051633d7b2f6f60e21b815261ffff808616600483015284166024820152306044820152606481018290526060907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063f5ecbdbc90608401600060405180830381865afa158015612158573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261218091908101906149bf565b95945050505050565b60008183116121985781610fe8565b5090919050565b604051633356ae4560e11b815230906366ad5c8a906121c89087908790879087906004016149f3565b600060405180830381600087803b1580156121e257600080fd5b505af19250505080156121f3575060015b6116b9578080519060200120600260008661ffff1661ffff16815260200190815260200160002084604051612228919061495e565b9081526040805191829003602090810183206001600160401b0387166000908152915220919091557fe6f254030bcb01ffd20558175c13fcaed6d1520be7becee4c961b65f79243b0d906122839086908690869086906149f3565b60405180910390a16116b9565b60006001600160e01b031982166380ac58cd60e01b14806122c157506001600160e01b03198216635b5e139f60e01b145b80610b105750610b108261313d565b6000546001600160a01b031633146119345760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016109cf565b6000818152600560205260409020546001600160a01b03166120d55760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016109cf565b600081815260076020526040902080546001600160a01b0319166001600160a01b03841690811790915581906123be826115fe565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600c54861061241c576040516369face4b60e01b8152600481018790526024016109cf565b8260000361243b5760405161b08960e51b815260040160405180910390fd5b6001600160a01b03851661246257604051633efa09af60e01b815260040160405180910390fd5b6000600c8781548110612477576124776146e9565b6000918252602091829020604080516101008082018352600294909402909201805483526001015460ff8082161515958401959095529283046001600160401b03908116918301829052600160481b840481166060840152600160881b8404166080830152600160c81b8304841660a0830152600160d01b8304909316151560c0820152600160d81b90910464ffffffffff1660e0820152915042108061252a575080606001516001600160401b031642115b15612572576040808201516060830151915163dbd9eee560e01b8152600481018a90526001600160401b039182166024820152911660448201524260648201526084016109cf565b8060200151156125f4576040516bffffffffffffffffffffffff19606088901b166020820152603481018690526000906054016040516020818303038152906040528051906020012090506125cd8260000151858584613172565b6125f2578787858560405163ec52462d60e01b81526004016109cf9493929190614a31565b505b608081015161260c906001600160401b031685614a66565b3414612650576080810151604051632fe9a5db60e21b8152600481018990523460248201526001600160401b039091166044820152606481018590526084016109cf565b60008160200151612668578160a0015160ff1661266a565b855b6000898152600d602090815260408083206001600160a01b038c168452909152902054909150859061269c9083614814565b10156126d457604051637d50477960e11b8152600481018990526001600160a01b0388166024820152604481018290526064016109cf565b600b5460095460009082906126ea90600161482b565b6126f49190614814565b90508060000361271757604051631097fc2b60e01b815260040160405180910390fd5b600061272382896131b6565b90508460c00151156127b05760008b8152600e602052604081205460e0870151612754919064ffffffffff16614814565b90508060000361277a576040516326c69e1560e11b8152600481018d90526024016109cf565b61278481836131b6565b915081600e60008e815260200190815260200160002060008282546127a9919061482b565b9091555050505b60008b8152600d602090815260408083206001600160a01b038e168452909152812080548392906127e290849061482b565b9250508190555080600b60008282546127fb919061482b565b90915550600090505b818110156128225761281a8b6117f6838761482b565b600101612804565b50896001600160a01b03168b7fdc331af4e71bb8ec56b1a0d719543254ff272f4f63e9ea61cea22c149f78ccb38360405161285f91815260200190565b60405180910390a3878110156128fd57336108fc61287d838b614814565b87608001516001600160401b03166128959190614a66565b6040518115909202916000818181858888f193505050501580156128bd573d6000803e3d6000fd5b50338b7fd712b46ccde5e095a18ecd18aed6bf9d83d9263601d1942365932b15f23cd7da6128eb848c614814565b60405190815260200160405180910390a35b5050505050505050505050565b600080612916836115fe565b9050806001600160a01b0316846001600160a01b0316148061295d57506001600160a01b0380821660009081526008602090815260408083209388168352929052205460ff165b80610e505750836001600160a01b031661297684610c80565b6001600160a01b031614949350505050565b826001600160a01b031661299b826115fe565b6001600160a01b0316146129c15760405162461bcd60e51b81526004016109cf90614a85565b6001600160a01b038216612a235760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016109cf565b826001600160a01b0316612a36826115fe565b6001600160a01b031614612a5c5760405162461bcd60e51b81526004016109cf90614a85565b600081815260076020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260068552838620805460001901905590871680865283862080546001019055868652600590945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b846001600160401b0316866001600160401b03161115612b3257604051638a6b90c960e01b81526001600160401b038088166004830152861660248201526044016109cf565b838015612b3d575082155b15612b5b57604051631583bdc160e11b815260040160405180910390fd5b818015612b6d575064ffffffffff8116155b15611bcc576040516367164cfb60e01b815260040160405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610db79084906131c5565b60008082806020019051810190612bf49190614aca565b60148201519193509150612c0987828461329a565b806001600160a01b031686604051612c21919061495e565b604080519182900382208583526001600160401b03891660208401529161ffff8b16917f64e10c37f404d128982dce114f5d233c14c5c7f6d8db93099e3d99dacb9e27ba910160405180910390a450505050505050565b6001600160a01b038216612cce5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016109cf565b6000818152600560205260409020546001600160a01b031615612d335760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016109cf565b6000818152600560205260409020546001600160a01b031615612d985760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016109cf565b6001600160a01b038216600081815260066020908152604080832080546001019055848352600590915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b816001600160a01b0316836001600160a01b031603612eb45760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016109cf565b6001600160a01b03838116600081815260086020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b612f2c848484612988565b612f38848484846132a4565b6116b95760405162461bcd60e51b81526004016109cf90614b10565b6060600a8054610b7b906145fe565b60606000612f70836133a2565b60010190506000816001600160401b03811115612f8f57612f8f613ad4565b6040519080825280601f01601f191660200182016040528015612fb9576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084612fc357509392505050565b6130018787878761347a565b600085856040516020016130169291906146ff565b60405160208183030381529060405290506130348782868686613541565b604051630f428ae960e31b815261ffff881660048201523060248201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690637a14574890604401602060405180830381865afa1580156130a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130c99190614b62565b9050866040516130d9919061495e565b604080519182900382208883526001600160401b03841660208401529161ffff8b16916001600160a01b038d16917f024797cc77ce15dc717112d54fb1df125fdfd8c81344fb046c5e074427ce1543910160405180910390a4505050505050505050565b60006001600160e01b03198216636279b16960e11b1480610b1057506301ffc9a760e01b6001600160e01b0319831614610b10565b600061218085838686808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509294939250506136b49050565b60008183106121985781610fe8565b600061321a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166136ca9092919063ffffffff16565b905080516000148061323b57508080602001905181019061323b919061467f565b610db75760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016109cf565b610db782826136d9565b60006001600160a01b0384163b1561339a57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906132e8903390899088908890600401614b7f565b6020604051808303816000875af1925050508015613323575060408051601f3d908101601f1916820190925261332091810190614bb2565b60015b613380573d808015613351576040519150601f19603f3d011682016040523d82523d6000602084013e613356565b606091505b5080516000036133785760405162461bcd60e51b81526004016109cf90614b10565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610e50565b506001610e50565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106133e15772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef8100000000831061340d576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061342b57662386f26fc10000830492506010015b6305f5e1008310613443576305f5e100830492506008015b612710831061345757612710830492506004015b60648310613469576064830492506002015b600a8310610b105760010192915050565b61348333610eef565b6134cf5760405162461bcd60e51b815260206004820152601f60248201527f4f4e46543732313a206e6f74206f776e6572206e6f7220617070726f7665640060448201526064016109cf565b836001600160a01b03166134e2826115fe565b6001600160a01b0316146135385760405162461bcd60e51b815260206004820152601860248201527f4f4e46543732313a20696e636f7272656374206f776e6572000000000000000060448201526064016109cf565b6116b9816136f3565b61ffff85166000908152600160205260408120805461355f906145fe565b80601f016020809104026020016040519081016040528092919081815260200182805461358b906145fe565b80156135d85780601f106135ad576101008083540402835291602001916135d8565b820191906000526020600020905b8154815290600101906020018083116135bb57829003601f168201915b5050505050905080516000036136305760405162461bcd60e51b815260206004820152601860248201527f4c7a53656e643a20217472757374656420736f757263652e000000000000000060448201526064016109cf565b60405162c5803160e81b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c5803100903490613687908a9086908b908b908b908b90600401614bcf565b6000604051808303818588803b1580156136a057600080fd5b505af11580156128fd573d6000803e3d6000fd5b6000826136c18584613788565b14949350505050565b6060610e5084846000856137d5565b611bdf8282604051806020016040528060008152506138b0565b60006136fe826115fe565b9050613709826115fe565b600083815260076020908152604080832080546001600160a01b03199081169091556001600160a01b0385168085526006845282852080546000190190558785526005909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b600081815b84518110156137cd576137b9828683815181106137ac576137ac6146e9565b60200260200101516138e3565b9150806137c581614c36565b91505061378d565b509392505050565b6060824710156138365760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016109cf565b600080866001600160a01b03168587604051613852919061495e565b60006040518083038185875af1925050503d806000811461388f576040519150601f19603f3d011682016040523d82523d6000602084013e613894565b606091505b50915091506138a587838387613912565b979650505050505050565b6138ba8383612c78565b6138c760008484846132a4565b610db75760405162461bcd60e51b81526004016109cf90614b10565b60008183106138ff576000828152602084905260409020610fe8565b6000838152602083905260409020610fe8565b6060831561398157825160000361397a576001600160a01b0385163b61397a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109cf565b5081610e50565b610e5083838151156139965781518083602001fd5b8060405162461bcd60e51b81526004016109cf9190613d0f565b8280546139bc906145fe565b90600052602060002090601f0160209004810192826139de5760008555613a24565b82601f106139f757805160ff1916838001178555613a24565b82800160010185558215613a24579182015b82811115613a24578251825591602001919060010190613a09565b50613a30929150613aa8565b5090565b828054613a40906145fe565b90600052602060002090601f016020900481019282613a625760008555613a24565b82601f10613a7b5782800160ff19823516178555613a24565b82800160010185558215613a24579182015b82811115613a24578235825591602001919060010190613a8d565b5b80821115613a305760008155600101613aa9565b803561ffff81168114613acf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715613b1257613b12613ad4565b604052919050565b60006001600160401b03821115613b3357613b33613ad4565b50601f01601f191660200190565b6000613b54613b4f84613b1a565b613aea565b9050828152838383011115613b6857600080fd5b828260208301376000602084830101529392505050565b600082601f830112613b9057600080fd5b610fe883833560208501613b41565b6001600160401b03811681146120d557600080fd5b60008060008060808587031215613bca57600080fd5b613bd385613abd565b935060208501356001600160401b0380821115613bef57600080fd5b613bfb88838901613b7f565b945060408701359150613c0d82613b9f565b90925060608601359080821115613c2357600080fd5b50613c3087828801613b7f565b91505092959194509250565b6001600160e01b0319811681146120d557600080fd5b600060208284031215613c6457600080fd5b8135610fe881613c3c565b600060208284031215613c8157600080fd5b81356001600160401b03811115613c9757600080fd5b8201601f81018413613ca857600080fd5b610e5084823560208401613b41565b60005b83811015613cd2578181015183820152602001613cba565b838111156116b95750506000910152565b60008151808452613cfb816020860160208601613cb7565b601f01601f19169290920160200192915050565b602081526000610fe86020830184613ce3565b600060208284031215613d3457600080fd5b610fe882613abd565b600060208284031215613d4f57600080fd5b5035919050565b6001600160a01b03811681146120d557600080fd5b60008060408385031215613d7e57600080fd5b8235613d8981613d56565b946020939093013593505050565b60008083601f840112613da957600080fd5b5081356001600160401b03811115613dc057600080fd5b602083019150836020828501011115613dd857600080fd5b9250929050565b600080600060408486031215613df457600080fd5b613dfd84613abd565b925060208401356001600160401b03811115613e1857600080fd5b613e2486828701613d97565b9497909650939450505050565b60008060008060808587031215613e4757600080fd5b8435613e5281613d56565b93506020850135613e6281613d56565b92506040850135915060608501356001600160401b03811115613e8457600080fd5b613c3087828801613b7f565b60008083601f840112613ea257600080fd5b5081356001600160401b03811115613eb957600080fd5b6020830191508360208260051b8501011115613dd857600080fd5b600080600080600060808688031215613eec57600080fd5b853594506020860135613efe81613d56565b93506040860135925060608601356001600160401b03811115613f2057600080fd5b613f2c88828901613e90565b969995985093965092949392505050565b600080600060608486031215613f5257600080fd5b8335613f5d81613d56565b92506020840135613f6d81613d56565b929592945050506040919091013590565b80151581146120d557600080fd5b600080600080600060a08688031215613fa457600080fd5b613fad86613abd565b945060208601356001600160401b0380821115613fc957600080fd5b613fd589838a01613b7f565b95506040880135945060608801359150613fee82613f7e565b9092506080870135908082111561400457600080fd5b5061401188828901613b7f565b9150509295509295909350565b803560ff81168114613acf57600080fd5b803564ffffffffff81168114613acf57600080fd5b600080600080600080600080610100898b03121561406157600080fd5b88359750602089013561407381613b9f565b9650604089013561408381613b9f565b955061409160608a0161401e565b945060808901356140a181613b9f565b935060a08901356140b181613f7e565b925060c089013591506140c660e08a0161402f565b90509295985092959890939650565b6000806000606084860312156140ea57600080fd5b6140f384613abd565b925060208401356001600160401b0381111561410e57600080fd5b61411a86828701613b7f565b925050604084013561412b81613b9f565b809150509250925092565b6000806040838503121561414957600080fd5b82359150602083013561415b81613d56565b809150509250929050565b6000806000806040858703121561417c57600080fd5b84356001600160401b038082111561419357600080fd5b61419f88838901613e90565b909650945060208701359150808211156141b857600080fd5b506141c587828801613e90565b95989497509550505050565b6000602082840312156141e357600080fd5b8135610fe881613d56565b600080600080600080600080610100898b03121561420b57600080fd5b883561421681613b9f565b9750602089013561422681613b9f565b965061423460408a0161401e565b9550606089013561424481613b9f565b9450608089013561425481613f7e565b935060a0890135925060c089013561426b81613f7e565b91506140c660e08a0161402f565b60008060008060008060a0878903121561429257600080fd5b8635955060208701356142a481613d56565b9450604087013593506060870135925060808701356001600160401b038111156142cd57600080fd5b6142d989828a01613e90565b979a9699509497509295939492505050565b600080604083850312156142fe57600080fd5b823561430981613d56565b9150602083013561415b81613f7e565b60008060008060006060868803121561433157600080fd5b61433a86613abd565b945060208601356001600160401b038082111561435657600080fd5b61436289838a01613d97565b9096509450604088013591508082111561437b57600080fd5b50613f2c88828901613d97565b6000806000806000608086880312156143a057600080fd5b6143a986613abd565b94506143b760208701613abd565b93506040860135925060608601356001600160401b038111156143d957600080fd5b613f2c88828901613d97565b6000806000806000608086880312156143fd57600080fd5b61440686613abd565b945060208601356001600160401b038082111561442257600080fd5b61442e89838a01613b7f565b95506040880135915061444082613b9f565b9093506060870135908082111561437b57600080fd5b6000610100820190508251825260208301511515602083015260408301516001600160401b038082166040850152806060860151166060850152806080860151166080850152505060ff60a08401511660a083015260c08301516144be60c084018215159052565b5060e08301516144d760e084018264ffffffffff169052565b5092915050565b600080604083850312156144f157600080fd5b82356144fc81613d56565b9150602083013561415b81613d56565b60008060008060008060c0878903121561452557600080fd5b61452e87613abd565b955060208701356001600160401b038082111561454a57600080fd5b6145568a838b01613b7f565b9650604089013595506060890135915061456f82613d56565b90935060808801359061458182613d56565b90925060a0880135908082111561459757600080fd5b506145a489828a01613b7f565b9150509295509295509295565b600080600080608085870312156145c757600080fd5b6145d085613abd565b93506145de60208601613abd565b925060408501356145ee81613d56565b9396929550929360600135925050565b600181811c9082168061461257607f821691505b60208210810361463257634e487b7160e01b600052602260045260246000fd5b50919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b61ffff84168152604060208201526000612180604083018486614638565b60006020828403121561469157600080fd5b8151610fe881613f7e565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b6040815260006147126040830185613ce3565b90508260208301529392505050565b61ffff861681526001600160a01b038516602082015260a06040820181905260009061474f90830186613ce3565b841515606084015282810360808401526147698185613ce3565b98975050505050505050565b6000806040838503121561478857600080fd5b505080516020909101519092909150565b8183823760009101908152919050565b6001600160401b039889168152968816602088015260ff9590951660408701529290951660608501521515608084015260a083019390935291151560c082015264ffffffffff90911660e08201526101000190565b634e487b7160e01b600052601160045260246000fd5b600082821015614826576148266147fe565b500390565b6000821982111561483e5761483e6147fe565b500190565b81835260006001600160fb1b0383111561485c57600080fd5b8260051b8083602087013760009401602001938452509192915050565b6040808252810184905260008560608301825b878110156148bc57823561489f81613d56565b6001600160a01b031682526020928301929091019060010161488c565b508381036020850152614769818688614843565b61ffff861681526060602082015260006148ee606083018688614638565b8281036040840152614769818587614638565b60008351614913818460208801613cb7565b835190830190614927818360208801613cb7565b01949350505050565b600061ffff8088168352808716602084015250846040830152608060608301526138a5608083018486614638565b60008251614970818460208701613cb7565b9190910192915050565b600082601f83011261498b57600080fd5b8151614999613b4f82613b1a565b8181528460208386010111156149ae57600080fd5b610e50826020830160208701613cb7565b6000602082840312156149d157600080fd5b81516001600160401b038111156149e757600080fd5b610e508482850161497a565b61ffff85168152608060208201526000614a106080830186613ce3565b6001600160401b038516604084015282810360608401526138a58185613ce3565b8481526001600160a01b0384166020820152606060408201819052600090614a5c9083018486614843565b9695505050505050565b6000816000190483118215151615614a8057614a806147fe565b500290565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b60008060408385031215614add57600080fd5b82516001600160401b03811115614af357600080fd5b614aff8582860161497a565b925050602083015190509250929050565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b600060208284031215614b7457600080fd5b8151610fe881613b9f565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090614a5c90830184613ce3565b600060208284031215614bc457600080fd5b8151610fe881613c3c565b61ffff8716815260c060208201526000614bec60c0830188613ce3565b8281036040840152614bfe8188613ce3565b6001600160a01b0387811660608601528616608085015283810360a08501529050614c298185613ce3565b9998505050505050505050565b600060018201614c4857614c486147fe565b506001019056fea2646970667358221220f8398c73110d41a0391aaff732ff15ff46b12c8110f5d3186fc1e23543b4ec7b64736f6c634300080d003300000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd67500000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000d050000000000000000000000000000000000000000000000000000000000000011446566696d6f6e73204d6f6e737465727300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044d4f4e5300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003468747470733a2f2f70726f642d6261636b656e642e646566696d6f6e732e636f6d2f6d657461646174612f6d6f6e73746572732f000000000000000000000000
Deployed Bytecode
0x6080604052600436106102ad5760003560e01c806366ad5c8a11610175578063aaff5f16116100dc578063d8f6d59611610095578063eb8d72b71161006f578063eb8d72b7146108f0578063eed33cef14610910578063f2fde38b14610923578063f5ecbdbc1461094357600080fd5b8063d8f6d59614610865578063dd8027db14610892578063e985e9c5146108a757600080fd5b8063aaff5f16146107ab578063b353aaa7146107be578063b88d4fde146107f2578063c87b56dd14610812578063cbed8b9c14610832578063d1deba1f1461085257600080fd5b80637533d7881161012e5780637533d788146107055780638989ab3a146107255780638da5cb5b1461074557806395d89b41146107635780639ad4ae6c14610778578063a22cb4651461078b57600080fd5b806366ad5c8a1461066457806369f7d2f2146106845780636be78f76146106a457806370a08231146106ba578063715018a6146106da5780637501f741146106ef57600080fd5b8063285f12391161021957806344004cc1116101d257806344004cc114610544578063522f681514610564578063547520fe146105845780635b8c41e6146105a45780635d55159e146106015780636352211e1461064457600080fd5b8063285f12391461046f5780632a205e3d1461048f5780633d8b38f6146104c4578063402c67dc146104e457806342842e0e1461050457806342d65a8d1461052457600080fd5b8063095ea7b31161026b578063095ea7b3146103a35780630eaf6ea6146103c357806310ddb137146103e3578063150b7a021461040357806319c2c0221461043c57806323b872dd1461044f57600080fd5b80621d3567146102b257806301ffc9a7146102d457806302fe53051461030957806306fdde031461032957806307e0db171461034b578063081812fc1461036b575b600080fd5b3480156102be57600080fd5b506102d26102cd366004613bb4565b610963565b005b3480156102e057600080fd5b506102f46102ef366004613c52565b610af3565b60405190151581526020015b60405180910390f35b34801561031557600080fd5b506102d2610324366004613c6f565b610b16565b34801561033557600080fd5b5061033e610b6c565b6040516103009190613d0f565b34801561035757600080fd5b506102d2610366366004613d22565b610bfe565b34801561037757600080fd5b5061038b610386366004613d3d565b610c80565b6040516001600160a01b039091168152602001610300565b3480156103af57600080fd5b506102d26103be366004613d6b565b610ca7565b3480156103cf57600080fd5b506102f46103de366004613ddf565b610dbc565b3480156103ef57600080fd5b506102d26103fe366004613d22565b610e58565b34801561040f57600080fd5b5061042361041e366004613e31565b610eb0565b6040516001600160e01b03199091168152602001610300565b6102d261044a366004613ed4565b610edb565b34801561045b57600080fd5b506102d261046a366004613f3d565b610eea565b34801561047b57600080fd5b506102f461048a366004613d3d565b610f1c565b34801561049b57600080fd5b506104af6104aa366004613f8c565b610fef565b60408051928352602083019190915201610300565b3480156104d057600080fd5b506102f46104df366004613ddf565b6110ba565b3480156104f057600080fd5b506102d26104ff366004614044565b611186565b34801561051057600080fd5b506102d261051f366004613f3d565b61146a565b34801561053057600080fd5b506102d261053f366004613ddf565b611485565b34801561055057600080fd5b506102d261055f366004613f3d565b611514565b34801561057057600080fd5b506102d261057f366004613d6b565b611530565b34801561059057600080fd5b506102d261059f366004613d3d565b61156e565b3480156105b057600080fd5b506105f36105bf3660046140d5565b6002602090815260009384526040808520845180860184018051928152908401958401959095209452929052825290205481565b604051908152602001610300565b34801561060d57600080fd5b506105f361061c366004614136565b6000918252600d602090815260408084206001600160a01b0393909316845291905290205490565b34801561065057600080fd5b5061038b61065f366004613d3d565b6115fe565b34801561067057600080fd5b506102d261067f366004613bb4565b61165e565b34801561069057600080fd5b506102d261069f366004614166565b6116bf565b3480156106b057600080fd5b506105f3600b5481565b3480156106c657600080fd5b506105f36106d53660046141d1565b61189c565b3480156106e657600080fd5b506102d2611922565b3480156106fb57600080fd5b506105f360095481565b34801561071157600080fd5b5061033e610720366004613d22565b611936565b34801561073157600080fd5b506102d26107403660046141ee565b6119d0565b34801561075157600080fd5b506000546001600160a01b031661038b565b34801561076f57600080fd5b5061033e611baf565b6102d2610786366004614279565b611bbe565b34801561079757600080fd5b506102d26107a63660046142eb565b611bd4565b6102d26107b9366004614319565b611be3565b3480156107ca57600080fd5b5061038b7f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd67581565b3480156107fe57600080fd5b506102d261080d366004613e31565b611c70565b34801561081e57600080fd5b5061033e61082d366004613d3d565b611ca2565b34801561083e57600080fd5b506102d261084d366004614388565b611d08565b6102d26108603660046143e5565b611d64565b34801561087157600080fd5b50610885610880366004613d3d565b611ef7565b6040516103009190614456565b34801561089e57600080fd5b50600c546105f3565b3480156108b357600080fd5b506102f46108c23660046144de565b6001600160a01b03918216600090815260086020908152604080832093909416825291909152205460ff1690565b3480156108fc57600080fd5b506102d261090b366004613ddf565b611fe9565b6102d261091e36600461450c565b612050565b34801561092f57600080fd5b506102d261093e3660046141d1565b61205f565b34801561094f57600080fd5b5061033e61095e3660046145b1565b6120d8565b337f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd6756001600160a01b0316146109d85760405162461bcd60e51b8152602060048201526015602482015274131e949958d95a5d995c8e8808595b991c1bda5b9d605a1b60448201526064015b60405180910390fd5b61ffff8416600090815260016020526040812080546109f6906145fe565b80601f0160208091040260200160405190810160405280929190818152602001828054610a22906145fe565b8015610a6f5780601f10610a4457610100808354040283529160200191610a6f565b820191906000526020600020905b815481529060010190602001808311610a5257829003601f168201915b5050505050905080518451148015610a94575080805190602001208480519060200120145b610ae05760405162461bcd60e51b815260206004820152601a60248201527f4c7a52656365697665723a20696e76616c696420736f7572636500000000000060448201526064016109cf565b610aec8585858561219f565b5050505050565b60006001600160e01b031982161580610b105750610b1082612290565b92915050565b610b1e6122d0565b8051610b3190600a9060208401906139b0565b507f71cabd649e93e2aa1fae6b5fa734ff133e12a99dc1c56024d99ee03072ef473081604051610b619190613d0f565b60405180910390a150565b606060038054610b7b906145fe565b80601f0160208091040260200160405190810160405280929190818152602001828054610ba7906145fe565b8015610bf45780601f10610bc957610100808354040283529160200191610bf4565b820191906000526020600020905b815481529060010190602001808311610bd757829003601f168201915b5050505050905090565b610c066122d0565b6040516307e0db1760e01b815261ffff821660048201527f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd6756001600160a01b0316906307e0db17906024015b600060405180830381600087803b158015610c6c57600080fd5b505af1158015610aec573d6000803e3d6000fd5b6000610c8b8261232a565b506000908152600760205260409020546001600160a01b031690565b6000610cb2826115fe565b9050806001600160a01b0316836001600160a01b031603610d1f5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084016109cf565b336001600160a01b0382161480610d3b5750610d3b81336108c2565b610dad5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c00000060648201526084016109cf565b610db78383612389565b505050565b604051630757b75360e11b81526000906001600160a01b037f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd6751690630eaf6ea690610e0f90879087908790600401614661565b602060405180830381865afa158015610e2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e50919061467f565b949350505050565b610e606122d0565b6040516310ddb13760e01b815261ffff821660048201527f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd6756001600160a01b0316906310ddb13790602401610c52565b60006001600160a01b0385163014610eca57506000610e50565b50630a85bd0160e11b949350505050565b610aec858560008686866123f7565b610ef5335b8261290a565b610f115760405162461bcd60e51b81526004016109cf9061469c565b610db7838383612988565b600080600c8381548110610f3257610f326146e9565b6000918252602091829020604080516101008082018352600294909402909201805483526001015460ff8082161515958401959095529283046001600160401b03908116918301829052600160481b840481166060840152600160881b8404166080830152600160c81b8304841660a0830152600160d01b8304909316151560c0820152600160d81b90910464ffffffffff1660e082015291504210801590610fe8575080606001516001600160401b03164211155b9392505050565b600080600086866040516020016110079291906146ff565b60408051601f198184030181529082905263040a7bb160e41b825291506001600160a01b037f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd67516906340a7bb109061106b908b90309086908b908b90600401614721565b6040805180830381865afa158015611087573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ab9190614775565b92509250509550959350505050565b61ffff8316600090815260016020526040812080548291906110db906145fe565b80601f0160208091040260200160405190810160405280929190818152602001828054611107906145fe565b80156111545780601f1061112957610100808354040283529160200191611154565b820191906000526020600020905b81548152906001019060200180831161113757829003601f168201915b50505050509050838360405161116b929190614799565b60405180910390208180519060200120149150509392505050565b61118e6122d0565b600c5488106111b3576040516369face4b60e01b8152600481018990526024016109cf565b6000600c89815481106111c8576111c86146e9565b6000918252602091829020604080516101008082018352600294909402909201805483526001015460ff8082161515958401959095529283046001600160401b0390811691830191909152600160481b830481166060830152600160881b8304166080820152600160c81b8204831660a0820152600160d01b8204909216151560c08301819052600160d81b90910464ffffffffff1660e083015290915061127890899089908790879087612aec565b8060c00151801561129a57508060e0015164ffffffffff168264ffffffffff16105b156112c3576000898152600e60205260409020546112c09064ffffffffff841690612189565b91505b6001600160401b038089166040830152878116606083015260ff871660a083015285166080820152831515602082015282815264ffffffffff821660e0820152600c80548291908b90811061131a5761131a6146e9565b600091825260209182902083516002929092020190815590820151600190910180546040808501516060860151608087015160a088015160c0808a015160e0909a015168ffffffffffffffffff1990971698151568ffffffffffffffff001916989098176101006001600160401b039586160217600160481b600160c81b031916600160481b9385169390930267ffffffffffffffff60881b191692909217600160881b93909116929092029190911761ffff60c81b1916600160c81b60ff9092169190910260ff60d01b191617600160d01b95151595909502949094176001600160d81b0316600160d81b64ffffffffff9092169190910217905582015190518a917fca4b9e6417d974e30473076b47f788e71d2733b1b64abdcf8fe1bf05e8df94a991611457918c918c918c918c918c918c91908c906147a9565b60405180910390a2505050505050505050565b610db783838360405180602001604052806000815250611c70565b61148d6122d0565b6040516342d65a8d60e01b81526001600160a01b037f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd67516906342d65a8d906114dd90869086908690600401614661565b600060405180830381600087803b1580156114f757600080fd5b505af115801561150b573d6000803e3d6000fd5b50505050505050565b61151c6122d0565b610db76001600160a01b0384168383612b8b565b6115386122d0565b6040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015610db7573d6000803e3d6000fd5b6115766122d0565b6009548082036115995760405163147038e560e11b815260040160405180910390fd5b808210156115bc576115b9826001600b546115b49190614814565b612189565b91505b600982905560408051828152602081018490527f4057d55d57d7c3455178f70f11ab64978cb4ba22d8735c2ddd2025a98f7aea78910160405180910390a15050565b6000818152600560205260408120546001600160a01b031680610b105760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016109cf565b3330146116ad5760405162461bcd60e51b815260206004820181905260248201527f4c7a52656365697665723a2063616c6c6572206d757374206265204c7a41707060448201526064016109cf565b6116b984848484612bdd565b50505050565b6116c76122d0565b60008390036116e95760405163a9131fbf60e01b815260040160405180910390fd5b828114611709576040516323951ca360e21b815260040160405180910390fd5b600b546000805b8581101561181057600087878381811061172c5761172c6146e9565b905060200201602081019061174191906141d1565b6001600160a01b03160361176857604051633efa09af60e01b815260040160405180910390fd5b84848281811061177a5761177a6146e9565b9050602002013560000361179f5760405161b08960e51b815260040160405180910390fd5b60005b8585838181106117b4576117b46146e9565b90506020020135811015611807576117fb8888848181106117d7576117d76146e9565b90506020020160208101906117ec91906141d1565b6117f6858761482b565b612c78565b600192830192016117a2565b50600101611710565b5061181b818361482b565b600b55600954600161182d838561482b565b6118379190614814565b1115611857576001611849828461482b565b6118539190614814565b6009555b7faced0429065834f9a01f96efe0cc54bc74026a45af5045ff374b84a82027df6d8686868660405161188c9493929190614879565b60405180910390a1505050505050565b60006001600160a01b0382166119065760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b60648201526084016109cf565b506001600160a01b031660009081526006602052604090205490565b61192a6122d0565b6119346000612e03565b565b6001602052600090815260409020805461194f906145fe565b80601f016020809104026020016040519081016040528092919081815260200182805461197b906145fe565b80156119c85780601f1061199d576101008083540402835291602001916119c8565b820191906000526020600020905b8154815290600101906020018083116119ab57829003601f168201915b505050505081565b6119d86122d0565b6119e6888886868686612aec565b604080516101008082018352858252861515602083019081526001600160401b038c81169484019485528b8116606085019081528a82166080860190815260ff8d811660a088019081528a151560c0890190815264ffffffffff8b811660e08b01908152600c80546001808201835560008390528d517fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c76002909302928301559a517fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c890910180549e519951985196519551935168ffffffffffffffffff19909f1691151568ffffffffffffffff00191691909117988a16909b0297909717600160481b600160c81b031916600160481b9689169690960267ffffffffffffffff60881b191695909517600160881b93909716929092029590951761ffff60c81b1916600160c81b959092169490940260ff60d01b191617600160d01b91151591909102176001600160d81b0316600160d81b96909216959095021790915591549091611b7291614814565b7fd369d0dbe155f11a3f7fd5c7f1eb1763582e9bed3e4a93efbb84201d614506e68a8a8a8a8a8a8a8a6040516114579897969594939291906147a9565b606060048054610b7b906145fe565b611bcc8686868686866123f7565b505050505050565b611bdf338383612e53565b5050565b60405163557faf8b60e11b81526001600160a01b037f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd675169063aaff5f1690611c3790889088908890889088906004016148d0565b600060405180830381600087803b158015611c5157600080fd5b505af1158015611c65573d6000803e3d6000fd5b505050505050505050565b611c7a338361290a565b611c965760405162461bcd60e51b81526004016109cf9061469c565b6116b984848484612f21565b6060611cad8261232a565b6000611cb7612f54565b90506000815111611cd75760405180602001604052806000815250610fe8565b80611ce184612f63565b604051602001611cf2929190614901565b6040516020818303038152906040529392505050565b611d106122d0565b6040516332fb62e760e21b81526001600160a01b037f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd675169063cbed8b9c90611c379088908890889088908890600401614930565b61ffff85166000908152600260205260408082209051611d8590879061495e565b90815260408051602092819003830190206001600160401b03871660009081529252902054905080611df95760405162461bcd60e51b815260206004820152601d60248201527f4c7a52656365697665723a206e6f2073746f726564206d65737361676500000060448201526064016109cf565b808383604051611e0a929190614799565b604051809103902014611e5f5760405162461bcd60e51b815260206004820152601b60248201527f4c7a52656365697665723a20696e76616c6964207061796c6f6164000000000060448201526064016109cf565b61ffff86166000908152600260205260408082209051611e8090889061495e565b90815260200160405180910390206000866001600160401b03166001600160401b0316815260200190815260200160002081905550611bcc86868686868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250612bdd92505050565b6040805161010081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c0810182905260e0810191909152600c8281548110611f4b57611f4b6146e9565b6000918252602091829020604080516101008082018352600294909402909201805483526001015460ff8082161515958401959095529283046001600160401b0390811691830191909152600160481b830481166060830152600160881b8304166080820152600160c81b8204831660a0820152600160d01b8204909216151560c0830152600160d81b900464ffffffffff1660e082015292915050565b611ff16122d0565b61ffff8316600090815260016020526040902061200f908383613a34565b507ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab83838360405161204393929190614661565b60405180910390a1505050565b611bcc33878787878787612ff5565b6120676122d0565b6001600160a01b0381166120cc5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016109cf565b6120d581612e03565b50565b604051633d7b2f6f60e21b815261ffff808616600483015284166024820152306044820152606481018290526060907f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd6756001600160a01b03169063f5ecbdbc90608401600060405180830381865afa158015612158573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261218091908101906149bf565b95945050505050565b60008183116121985781610fe8565b5090919050565b604051633356ae4560e11b815230906366ad5c8a906121c89087908790879087906004016149f3565b600060405180830381600087803b1580156121e257600080fd5b505af19250505080156121f3575060015b6116b9578080519060200120600260008661ffff1661ffff16815260200190815260200160002084604051612228919061495e565b9081526040805191829003602090810183206001600160401b0387166000908152915220919091557fe6f254030bcb01ffd20558175c13fcaed6d1520be7becee4c961b65f79243b0d906122839086908690869086906149f3565b60405180910390a16116b9565b60006001600160e01b031982166380ac58cd60e01b14806122c157506001600160e01b03198216635b5e139f60e01b145b80610b105750610b108261313d565b6000546001600160a01b031633146119345760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016109cf565b6000818152600560205260409020546001600160a01b03166120d55760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b60448201526064016109cf565b600081815260076020526040902080546001600160a01b0319166001600160a01b03841690811790915581906123be826115fe565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600c54861061241c576040516369face4b60e01b8152600481018790526024016109cf565b8260000361243b5760405161b08960e51b815260040160405180910390fd5b6001600160a01b03851661246257604051633efa09af60e01b815260040160405180910390fd5b6000600c8781548110612477576124776146e9565b6000918252602091829020604080516101008082018352600294909402909201805483526001015460ff8082161515958401959095529283046001600160401b03908116918301829052600160481b840481166060840152600160881b8404166080830152600160c81b8304841660a0830152600160d01b8304909316151560c0820152600160d81b90910464ffffffffff1660e0820152915042108061252a575080606001516001600160401b031642115b15612572576040808201516060830151915163dbd9eee560e01b8152600481018a90526001600160401b039182166024820152911660448201524260648201526084016109cf565b8060200151156125f4576040516bffffffffffffffffffffffff19606088901b166020820152603481018690526000906054016040516020818303038152906040528051906020012090506125cd8260000151858584613172565b6125f2578787858560405163ec52462d60e01b81526004016109cf9493929190614a31565b505b608081015161260c906001600160401b031685614a66565b3414612650576080810151604051632fe9a5db60e21b8152600481018990523460248201526001600160401b039091166044820152606481018590526084016109cf565b60008160200151612668578160a0015160ff1661266a565b855b6000898152600d602090815260408083206001600160a01b038c168452909152902054909150859061269c9083614814565b10156126d457604051637d50477960e11b8152600481018990526001600160a01b0388166024820152604481018290526064016109cf565b600b5460095460009082906126ea90600161482b565b6126f49190614814565b90508060000361271757604051631097fc2b60e01b815260040160405180910390fd5b600061272382896131b6565b90508460c00151156127b05760008b8152600e602052604081205460e0870151612754919064ffffffffff16614814565b90508060000361277a576040516326c69e1560e11b8152600481018d90526024016109cf565b61278481836131b6565b915081600e60008e815260200190815260200160002060008282546127a9919061482b565b9091555050505b60008b8152600d602090815260408083206001600160a01b038e168452909152812080548392906127e290849061482b565b9250508190555080600b60008282546127fb919061482b565b90915550600090505b818110156128225761281a8b6117f6838761482b565b600101612804565b50896001600160a01b03168b7fdc331af4e71bb8ec56b1a0d719543254ff272f4f63e9ea61cea22c149f78ccb38360405161285f91815260200190565b60405180910390a3878110156128fd57336108fc61287d838b614814565b87608001516001600160401b03166128959190614a66565b6040518115909202916000818181858888f193505050501580156128bd573d6000803e3d6000fd5b50338b7fd712b46ccde5e095a18ecd18aed6bf9d83d9263601d1942365932b15f23cd7da6128eb848c614814565b60405190815260200160405180910390a35b5050505050505050505050565b600080612916836115fe565b9050806001600160a01b0316846001600160a01b0316148061295d57506001600160a01b0380821660009081526008602090815260408083209388168352929052205460ff165b80610e505750836001600160a01b031661297684610c80565b6001600160a01b031614949350505050565b826001600160a01b031661299b826115fe565b6001600160a01b0316146129c15760405162461bcd60e51b81526004016109cf90614a85565b6001600160a01b038216612a235760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b60648201526084016109cf565b826001600160a01b0316612a36826115fe565b6001600160a01b031614612a5c5760405162461bcd60e51b81526004016109cf90614a85565b600081815260076020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260068552838620805460001901905590871680865283862080546001019055868652600590945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b846001600160401b0316866001600160401b03161115612b3257604051638a6b90c960e01b81526001600160401b038088166004830152861660248201526044016109cf565b838015612b3d575082155b15612b5b57604051631583bdc160e11b815260040160405180910390fd5b818015612b6d575064ffffffffff8116155b15611bcc576040516367164cfb60e01b815260040160405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610db79084906131c5565b60008082806020019051810190612bf49190614aca565b60148201519193509150612c0987828461329a565b806001600160a01b031686604051612c21919061495e565b604080519182900382208583526001600160401b03891660208401529161ffff8b16917f64e10c37f404d128982dce114f5d233c14c5c7f6d8db93099e3d99dacb9e27ba910160405180910390a450505050505050565b6001600160a01b038216612cce5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f206164647265737360448201526064016109cf565b6000818152600560205260409020546001600160a01b031615612d335760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016109cf565b6000818152600560205260409020546001600160a01b031615612d985760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e7465640000000060448201526064016109cf565b6001600160a01b038216600081815260066020908152604080832080546001019055848352600590915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b816001600160a01b0316836001600160a01b031603612eb45760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c65720000000000000060448201526064016109cf565b6001600160a01b03838116600081815260086020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b612f2c848484612988565b612f38848484846132a4565b6116b95760405162461bcd60e51b81526004016109cf90614b10565b6060600a8054610b7b906145fe565b60606000612f70836133a2565b60010190506000816001600160401b03811115612f8f57612f8f613ad4565b6040519080825280601f01601f191660200182016040528015612fb9576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084612fc357509392505050565b6130018787878761347a565b600085856040516020016130169291906146ff565b60405160208183030381529060405290506130348782868686613541565b604051630f428ae960e31b815261ffff881660048201523060248201526000907f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd6756001600160a01b031690637a14574890604401602060405180830381865afa1580156130a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130c99190614b62565b9050866040516130d9919061495e565b604080519182900382208883526001600160401b03841660208401529161ffff8b16916001600160a01b038d16917f024797cc77ce15dc717112d54fb1df125fdfd8c81344fb046c5e074427ce1543910160405180910390a4505050505050505050565b60006001600160e01b03198216636279b16960e11b1480610b1057506301ffc9a760e01b6001600160e01b0319831614610b10565b600061218085838686808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509294939250506136b49050565b60008183106121985781610fe8565b600061321a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166136ca9092919063ffffffff16565b905080516000148061323b57508080602001905181019061323b919061467f565b610db75760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016109cf565b610db782826136d9565b60006001600160a01b0384163b1561339a57604051630a85bd0160e11b81526001600160a01b0385169063150b7a02906132e8903390899088908890600401614b7f565b6020604051808303816000875af1925050508015613323575060408051601f3d908101601f1916820190925261332091810190614bb2565b60015b613380573d808015613351576040519150601f19603f3d011682016040523d82523d6000602084013e613356565b606091505b5080516000036133785760405162461bcd60e51b81526004016109cf90614b10565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050610e50565b506001610e50565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106133e15772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef8100000000831061340d576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061342b57662386f26fc10000830492506010015b6305f5e1008310613443576305f5e100830492506008015b612710831061345757612710830492506004015b60648310613469576064830492506002015b600a8310610b105760010192915050565b61348333610eef565b6134cf5760405162461bcd60e51b815260206004820152601f60248201527f4f4e46543732313a206e6f74206f776e6572206e6f7220617070726f7665640060448201526064016109cf565b836001600160a01b03166134e2826115fe565b6001600160a01b0316146135385760405162461bcd60e51b815260206004820152601860248201527f4f4e46543732313a20696e636f7272656374206f776e6572000000000000000060448201526064016109cf565b6116b9816136f3565b61ffff85166000908152600160205260408120805461355f906145fe565b80601f016020809104026020016040519081016040528092919081815260200182805461358b906145fe565b80156135d85780601f106135ad576101008083540402835291602001916135d8565b820191906000526020600020905b8154815290600101906020018083116135bb57829003601f168201915b5050505050905080516000036136305760405162461bcd60e51b815260206004820152601860248201527f4c7a53656e643a20217472757374656420736f757263652e000000000000000060448201526064016109cf565b60405162c5803160e81b81526001600160a01b037f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd675169063c5803100903490613687908a9086908b908b908b908b90600401614bcf565b6000604051808303818588803b1580156136a057600080fd5b505af11580156128fd573d6000803e3d6000fd5b6000826136c18584613788565b14949350505050565b6060610e5084846000856137d5565b611bdf8282604051806020016040528060008152506138b0565b60006136fe826115fe565b9050613709826115fe565b600083815260076020908152604080832080546001600160a01b03199081169091556001600160a01b0385168085526006845282852080546000190190558785526005909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b600081815b84518110156137cd576137b9828683815181106137ac576137ac6146e9565b60200260200101516138e3565b9150806137c581614c36565b91505061378d565b509392505050565b6060824710156138365760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016109cf565b600080866001600160a01b03168587604051613852919061495e565b60006040518083038185875af1925050503d806000811461388f576040519150601f19603f3d011682016040523d82523d6000602084013e613894565b606091505b50915091506138a587838387613912565b979650505050505050565b6138ba8383612c78565b6138c760008484846132a4565b610db75760405162461bcd60e51b81526004016109cf90614b10565b60008183106138ff576000828152602084905260409020610fe8565b6000838152602083905260409020610fe8565b6060831561398157825160000361397a576001600160a01b0385163b61397a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109cf565b5081610e50565b610e5083838151156139965781518083602001fd5b8060405162461bcd60e51b81526004016109cf9190613d0f565b8280546139bc906145fe565b90600052602060002090601f0160209004810192826139de5760008555613a24565b82601f106139f757805160ff1916838001178555613a24565b82800160010185558215613a24579182015b82811115613a24578251825591602001919060010190613a09565b50613a30929150613aa8565b5090565b828054613a40906145fe565b90600052602060002090601f016020900481019282613a625760008555613a24565b82601f10613a7b5782800160ff19823516178555613a24565b82800160010185558215613a24579182015b82811115613a24578235825591602001919060010190613a8d565b5b80821115613a305760008155600101613aa9565b803561ffff81168114613acf57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715613b1257613b12613ad4565b604052919050565b60006001600160401b03821115613b3357613b33613ad4565b50601f01601f191660200190565b6000613b54613b4f84613b1a565b613aea565b9050828152838383011115613b6857600080fd5b828260208301376000602084830101529392505050565b600082601f830112613b9057600080fd5b610fe883833560208501613b41565b6001600160401b03811681146120d557600080fd5b60008060008060808587031215613bca57600080fd5b613bd385613abd565b935060208501356001600160401b0380821115613bef57600080fd5b613bfb88838901613b7f565b945060408701359150613c0d82613b9f565b90925060608601359080821115613c2357600080fd5b50613c3087828801613b7f565b91505092959194509250565b6001600160e01b0319811681146120d557600080fd5b600060208284031215613c6457600080fd5b8135610fe881613c3c565b600060208284031215613c8157600080fd5b81356001600160401b03811115613c9757600080fd5b8201601f81018413613ca857600080fd5b610e5084823560208401613b41565b60005b83811015613cd2578181015183820152602001613cba565b838111156116b95750506000910152565b60008151808452613cfb816020860160208601613cb7565b601f01601f19169290920160200192915050565b602081526000610fe86020830184613ce3565b600060208284031215613d3457600080fd5b610fe882613abd565b600060208284031215613d4f57600080fd5b5035919050565b6001600160a01b03811681146120d557600080fd5b60008060408385031215613d7e57600080fd5b8235613d8981613d56565b946020939093013593505050565b60008083601f840112613da957600080fd5b5081356001600160401b03811115613dc057600080fd5b602083019150836020828501011115613dd857600080fd5b9250929050565b600080600060408486031215613df457600080fd5b613dfd84613abd565b925060208401356001600160401b03811115613e1857600080fd5b613e2486828701613d97565b9497909650939450505050565b60008060008060808587031215613e4757600080fd5b8435613e5281613d56565b93506020850135613e6281613d56565b92506040850135915060608501356001600160401b03811115613e8457600080fd5b613c3087828801613b7f565b60008083601f840112613ea257600080fd5b5081356001600160401b03811115613eb957600080fd5b6020830191508360208260051b8501011115613dd857600080fd5b600080600080600060808688031215613eec57600080fd5b853594506020860135613efe81613d56565b93506040860135925060608601356001600160401b03811115613f2057600080fd5b613f2c88828901613e90565b969995985093965092949392505050565b600080600060608486031215613f5257600080fd5b8335613f5d81613d56565b92506020840135613f6d81613d56565b929592945050506040919091013590565b80151581146120d557600080fd5b600080600080600060a08688031215613fa457600080fd5b613fad86613abd565b945060208601356001600160401b0380821115613fc957600080fd5b613fd589838a01613b7f565b95506040880135945060608801359150613fee82613f7e565b9092506080870135908082111561400457600080fd5b5061401188828901613b7f565b9150509295509295909350565b803560ff81168114613acf57600080fd5b803564ffffffffff81168114613acf57600080fd5b600080600080600080600080610100898b03121561406157600080fd5b88359750602089013561407381613b9f565b9650604089013561408381613b9f565b955061409160608a0161401e565b945060808901356140a181613b9f565b935060a08901356140b181613f7e565b925060c089013591506140c660e08a0161402f565b90509295985092959890939650565b6000806000606084860312156140ea57600080fd5b6140f384613abd565b925060208401356001600160401b0381111561410e57600080fd5b61411a86828701613b7f565b925050604084013561412b81613b9f565b809150509250925092565b6000806040838503121561414957600080fd5b82359150602083013561415b81613d56565b809150509250929050565b6000806000806040858703121561417c57600080fd5b84356001600160401b038082111561419357600080fd5b61419f88838901613e90565b909650945060208701359150808211156141b857600080fd5b506141c587828801613e90565b95989497509550505050565b6000602082840312156141e357600080fd5b8135610fe881613d56565b600080600080600080600080610100898b03121561420b57600080fd5b883561421681613b9f565b9750602089013561422681613b9f565b965061423460408a0161401e565b9550606089013561424481613b9f565b9450608089013561425481613f7e565b935060a0890135925060c089013561426b81613f7e565b91506140c660e08a0161402f565b60008060008060008060a0878903121561429257600080fd5b8635955060208701356142a481613d56565b9450604087013593506060870135925060808701356001600160401b038111156142cd57600080fd5b6142d989828a01613e90565b979a9699509497509295939492505050565b600080604083850312156142fe57600080fd5b823561430981613d56565b9150602083013561415b81613f7e565b60008060008060006060868803121561433157600080fd5b61433a86613abd565b945060208601356001600160401b038082111561435657600080fd5b61436289838a01613d97565b9096509450604088013591508082111561437b57600080fd5b50613f2c88828901613d97565b6000806000806000608086880312156143a057600080fd5b6143a986613abd565b94506143b760208701613abd565b93506040860135925060608601356001600160401b038111156143d957600080fd5b613f2c88828901613d97565b6000806000806000608086880312156143fd57600080fd5b61440686613abd565b945060208601356001600160401b038082111561442257600080fd5b61442e89838a01613b7f565b95506040880135915061444082613b9f565b9093506060870135908082111561437b57600080fd5b6000610100820190508251825260208301511515602083015260408301516001600160401b038082166040850152806060860151166060850152806080860151166080850152505060ff60a08401511660a083015260c08301516144be60c084018215159052565b5060e08301516144d760e084018264ffffffffff169052565b5092915050565b600080604083850312156144f157600080fd5b82356144fc81613d56565b9150602083013561415b81613d56565b60008060008060008060c0878903121561452557600080fd5b61452e87613abd565b955060208701356001600160401b038082111561454a57600080fd5b6145568a838b01613b7f565b9650604089013595506060890135915061456f82613d56565b90935060808801359061458182613d56565b90925060a0880135908082111561459757600080fd5b506145a489828a01613b7f565b9150509295509295509295565b600080600080608085870312156145c757600080fd5b6145d085613abd565b93506145de60208601613abd565b925060408501356145ee81613d56565b9396929550929360600135925050565b600181811c9082168061461257607f821691505b60208210810361463257634e487b7160e01b600052602260045260246000fd5b50919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b61ffff84168152604060208201526000612180604083018486614638565b60006020828403121561469157600080fd5b8151610fe881613f7e565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b6040815260006147126040830185613ce3565b90508260208301529392505050565b61ffff861681526001600160a01b038516602082015260a06040820181905260009061474f90830186613ce3565b841515606084015282810360808401526147698185613ce3565b98975050505050505050565b6000806040838503121561478857600080fd5b505080516020909101519092909150565b8183823760009101908152919050565b6001600160401b039889168152968816602088015260ff9590951660408701529290951660608501521515608084015260a083019390935291151560c082015264ffffffffff90911660e08201526101000190565b634e487b7160e01b600052601160045260246000fd5b600082821015614826576148266147fe565b500390565b6000821982111561483e5761483e6147fe565b500190565b81835260006001600160fb1b0383111561485c57600080fd5b8260051b8083602087013760009401602001938452509192915050565b6040808252810184905260008560608301825b878110156148bc57823561489f81613d56565b6001600160a01b031682526020928301929091019060010161488c565b508381036020850152614769818688614843565b61ffff861681526060602082015260006148ee606083018688614638565b8281036040840152614769818587614638565b60008351614913818460208801613cb7565b835190830190614927818360208801613cb7565b01949350505050565b600061ffff8088168352808716602084015250846040830152608060608301526138a5608083018486614638565b60008251614970818460208701613cb7565b9190910192915050565b600082601f83011261498b57600080fd5b8151614999613b4f82613b1a565b8181528460208386010111156149ae57600080fd5b610e50826020830160208701613cb7565b6000602082840312156149d157600080fd5b81516001600160401b038111156149e757600080fd5b610e508482850161497a565b61ffff85168152608060208201526000614a106080830186613ce3565b6001600160401b038516604084015282810360608401526138a58185613ce3565b8481526001600160a01b0384166020820152606060408201819052600090614a5c9083018486614843565b9695505050505050565b6000816000190483118215151615614a8057614a806147fe565b500290565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b60008060408385031215614add57600080fd5b82516001600160401b03811115614af357600080fd5b614aff8582860161497a565b925050602083015190509250929050565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b600060208284031215614b7457600080fd5b8151610fe881613b9f565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090614a5c90830184613ce3565b600060208284031215614bc457600080fd5b8151610fe881613c3c565b61ffff8716815260c060208201526000614bec60c0830188613ce3565b8281036040840152614bfe8188613ce3565b6001600160a01b0387811660608601528616608085015283810360a08501529050614c298185613ce3565b9998505050505050505050565b600060018201614c4857614c486147fe565b506001019056fea2646970667358221220f8398c73110d41a0391aaff732ff15ff46b12c8110f5d3186fc1e23543b4ec7b64736f6c634300080d0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd67500000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000d050000000000000000000000000000000000000000000000000000000000000011446566696d6f6e73204d6f6e737465727300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044d4f4e5300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003468747470733a2f2f70726f642d6261636b656e642e646566696d6f6e732e636f6d2f6d657461646174612f6d6f6e73746572732f000000000000000000000000
-----Decoded View---------------
Arg [0] : name_ (string): Defimons Monsters
Arg [1] : symbol_ (string): MONS
Arg [2] : lzEndpoint_ (address): 0x66A71Dcef29A0fFBDBE3c6a460a3B5BC225Cd675
Arg [3] : initialURI_ (string): https://prod-backend.defimons.com/metadata/monsters/
Arg [4] : maxMint_ (uint256): 3333
-----Encoded View---------------
12 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [2] : 00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd675
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000120
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000d05
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000011
Arg [6] : 446566696d6f6e73204d6f6e7374657273000000000000000000000000000000
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [8] : 4d4f4e5300000000000000000000000000000000000000000000000000000000
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000034
Arg [10] : 68747470733a2f2f70726f642d6261636b656e642e646566696d6f6e732e636f
Arg [11] : 6d2f6d657461646174612f6d6f6e73746572732f000000000000000000000000
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.