Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
This contract has been verified via Sourcify.
View contract in Sourcify repository
- Contract name:
- NFTMarketplace
- Optimization enabled
- true
- Compiler version
- v0.8.20+commit.a1b79de6
- Optimization runs
- 200
- EVM Version
- shanghai
- Verified at
- 2026-01-21T20:47:01.676997Z
Marketplace.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
/**
* @title Simple NFT Marketplace
* @notice Fixed-price marketplace with ERC-2981 support
* @dev Uses pull-over-push payments. Platform fee capped at 3.69%.
*/
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
import "@openzeppelin/contracts/utils/Address.sol";
interface IERC2981 {
function royaltyInfo(uint256 tokenId, uint256 salePrice)
external
view
returns (address receiver, uint256 royaltyAmount);
}
contract NFTMarketplace is ReentrancyGuard, Ownable {
using Address for address payable;
bytes4 private constant _INTERFACE_ID_ERC2981 = 0x2a55205a;
bytes4 private constant _INTERFACE_ID_ERC721 = 0x80ac58cd;
uint256 private constant MAX_BATCH_SIZE = 20;
bool private _paused;
struct Listing {
address seller;
uint256 price;
bool active;
}
// nftContract => tokenId => Listing
mapping(address => mapping(uint256 => Listing)) public listings;
mapping(address => uint256) private _pendingPayments;
mapping(address => uint256) public failedRoyalties;
uint256 public platformFee = 69; // 0.69% in basis points
uint256 public constant MAX_FEE = 369; // 3.69% max
uint256 public totalPlatformFees;
// Events
event NFTListed(address indexed nftContract, uint256 indexed tokenId, address seller, uint256 price);
event NFTPriceUpdated(address indexed nftContract, uint256 indexed tokenId, uint256 oldPrice, uint256 newPrice);
event NFTSold(address indexed nftContract, uint256 indexed tokenId, address buyer, uint256 price, uint256 royaltyAmount, address royaltyRecipient, bool royaltyPaid);
event NFTDelisted(address indexed nftContract, uint256 indexed tokenId, address indexed seller);
event PlatformFeeUpdated(uint256 newFee);
event PaymentReleased(address indexed to, uint256 amount);
event RoyaltyPaymentFailed(address indexed recipient, uint256 amount);
event RoyaltyClaimed(address indexed recipient, uint256 amount);
event BatchPurchased(uint256 itemCount, uint256 successfulCount, uint256 totalSpent);
event BatchPurchaseRefund(address indexed buyer, uint256 refundAmount, uint256 failedItems);
event Paused(address account);
event Unpaused(address account);
modifier whenNotPaused() {
require(!_paused, "Contract paused");
_;
}
constructor() Ownable(msg.sender) {}
// ============ LISTING FUNCTIONS ============
function listNFT(address nftContract, uint256 tokenId, uint256 price)
external
nonReentrant
whenNotPaused
{
_validateAndList(nftContract, tokenId, price, msg.sender);
}
function updatePrice(address nftContract, uint256 tokenId, uint256 newPrice)
external
nonReentrant
whenNotPaused
{
require(newPrice > 0, "Price must be > 0");
Listing storage listing = listings[nftContract][tokenId];
require(listing.active && listing.seller == msg.sender, "Not seller or not active");
// Verify caller still owns the NFT
IERC721 nft = IERC721(nftContract);
require(nft.ownerOf(tokenId) == msg.sender, "Not owner");
_validateNFTApproval(nftContract, tokenId, listing.seller);
emit NFTPriceUpdated(nftContract, tokenId, listing.price, newPrice);
listing.price = newPrice;
}
/// @notice Delist a single NFT (seller only)
function delistNFT(address nftContract, uint256 tokenId)
external
nonReentrant
whenNotPaused
{
Listing storage listing = listings[nftContract][tokenId];
require(listing.active && listing.seller == msg.sender, "Not seller or not active");
listing.active = false;
emit NFTDelisted(nftContract, tokenId, msg.sender);
// Optional: fully delete to refund storage (saves gas on future ops)
delete listings[nftContract][tokenId];
}
/// @notice Batch list NFTs (max 20)
function batchListNFTs(
address[] calldata nftContracts,
uint256[] calldata tokenIds,
uint256[] calldata prices
) external nonReentrant whenNotPaused {
require(nftContracts.length == tokenIds.length && nftContracts.length == prices.length, "Length mismatch");
require(nftContracts.length <= MAX_BATCH_SIZE, "Batch too large");
for (uint256 i = 0; i < nftContracts.length; i++) {
_validateAndList(nftContracts[i], tokenIds[i], prices[i], msg.sender);
}
}
/// @notice Batch delist NFTs
function batchDelistNFTs(address[] calldata nftContracts, uint256[] calldata tokenIds)
external
nonReentrant
whenNotPaused
{
require(nftContracts.length == tokenIds.length, "Length mismatch");
require(nftContracts.length <= MAX_BATCH_SIZE, "Batch too large");
for (uint256 i = 0; i < nftContracts.length; i++) {
Listing storage listing = listings[nftContracts[i]][tokenIds[i]];
require(listing.active && listing.seller == msg.sender, "Not seller or not active");
listing.active = false;
emit NFTDelisted(nftContracts[i], tokenIds[i], msg.sender);
}
}
// ============ BUYING FUNCTIONS ============
function buyNFT(address nftContract, uint256 tokenId)
external
payable
nonReentrant
whenNotPaused
{
Listing memory listing = listings[nftContract][tokenId];
require(listing.active, "Not listed");
require(msg.value == listing.price, "Exact payment required");
(uint256 royaltyAmount, address royaltyRecipient, bool royaltyPaid) = _executePurchase(nftContract, tokenId);
emit NFTSold(nftContract, tokenId, msg.sender, listing.price, royaltyAmount, royaltyRecipient, royaltyPaid);
}
/// @notice Fixed batch buy with accurate refunds and events
function batchBuyNFTs(address[] calldata nftContracts, uint256[] calldata tokenIds)
external
payable
nonReentrant
whenNotPaused
{
require(nftContracts.length == tokenIds.length, "Length mismatch");
require(nftContracts.length <= MAX_BATCH_SIZE, "Batch too large");
uint256 itemCount = nftContracts.length;
require(itemCount > 0, "Empty batch");
// Validate all listings and compute total required
(uint256 totalRequired, uint256[] memory prices, address[] memory sellers) =
_validateBatchListings(nftContracts, tokenIds);
require(msg.value >= totalRequired, "Insufficient payment");
// Execute purchases
(uint256 totalSpent, uint256 successfulPurchases) =
_executeBatchPurchases(nftContracts, tokenIds, prices, sellers, itemCount);
// Refund any overpayment or failed items
if (msg.value > totalSpent) {
uint256 refundAmount = msg.value - totalSpent;
_pendingPayments[msg.sender] += refundAmount;
emit BatchPurchaseRefund(msg.sender, refundAmount, itemCount - successfulPurchases);
}
emit BatchPurchased(itemCount, successfulPurchases, totalSpent);
}
// ============ WITHDRAWAL FUNCTIONS ============
function withdrawPayments() external nonReentrant {
uint256 amount = _pendingPayments[msg.sender];
require(amount > 0, "No balance");
_pendingPayments[msg.sender] = 0;
(bool success, ) = payable(msg.sender).call{value: amount}("");
require(success, "Transfer failed");
emit PaymentReleased(msg.sender, amount);
}
function claimFailedRoyalty() external nonReentrant {
uint256 amount = failedRoyalties[msg.sender];
require(amount > 0, "No royalties");
failedRoyalties[msg.sender] = 0;
(bool success, ) = payable(msg.sender).call{value: amount}("");
require(success, "Transfer failed");
emit RoyaltyClaimed(msg.sender, amount);
}
// ============ ADMIN FUNCTIONS ============
function updatePlatformFee(uint256 newFee) external onlyOwner {
require(newFee <= MAX_FEE, "Fee too high");
platformFee = newFee;
emit PlatformFeeUpdated(newFee);
}
function withdrawPlatformFees() external onlyOwner {
uint256 amount = totalPlatformFees;
require(amount > 0, "No fees");
totalPlatformFees = 0;
(bool success, ) = payable(owner()).call{value: amount}("");
require(success, "Transfer failed");
emit PaymentReleased(owner(), amount);
}
function pause() external onlyOwner {
_paused = true;
emit Paused(msg.sender);
}
function unpause() external onlyOwner {
_paused = false;
emit Unpaused(msg.sender);
}
// ============ VIEW FUNCTIONS ============
function getListing(address nftContract, uint256 tokenId)
external
view
returns (address seller, uint256 price, bool active)
{
Listing memory listing = listings[nftContract][tokenId];
return (listing.seller, listing.price, listing.active);
}
function pendingPayment(address payee) external view returns (uint256) {
return _pendingPayments[payee];
}
function paused() external view returns (bool) {
return _paused;
}
// ============ INTERNAL FUNCTIONS ============
/// @notice Validate batch listings and compute total required payment
function _validateBatchListings(
address[] calldata nftContracts,
uint256[] calldata tokenIds
) internal view returns (uint256 totalRequired, uint256[] memory prices, address[] memory sellers) {
uint256 itemCount = nftContracts.length;
prices = new uint256[](itemCount);
sellers = new address[](itemCount);
for (uint256 i = 0; i < itemCount; i++) {
Listing memory listing = listings[nftContracts[i]][tokenIds[i]];
require(listing.active, "One or more not listed");
prices[i] = listing.price;
sellers[i] = listing.seller;
totalRequired += listing.price;
}
}
/// @notice Execute batch purchases with validation before each purchase
function _executeBatchPurchases(
address[] calldata nftContracts,
uint256[] calldata tokenIds,
uint256[] memory prices,
address[] memory sellers,
uint256 itemCount
) internal returns (uint256 totalSpent, uint256 successfulPurchases) {
for (uint256 i = 0; i < itemCount; i++) {
// Re-validate listing status and price before purchase to prevent race conditions
Listing memory currentListing = listings[nftContracts[i]][tokenIds[i]];
// Check if listing is still active and price hasn't changed
if (currentListing.active &&
currentListing.price == prices[i] &&
currentListing.seller == sellers[i]) {
// Attempt purchase - if it fails (e.g. transfer revert), skip and refund
// Use address(this) to call the external helper function
try this._tryExecutePurchase(nftContracts[i], tokenIds[i], prices[i])
returns (bool purchaseSuccess, uint256 royaltyAmount, address royaltyRecipient, bool royaltyPaid)
{
if (purchaseSuccess) {
totalSpent += prices[i];
successfulPurchases++;
emit NFTSold(
nftContracts[i],
tokenIds[i],
msg.sender,
prices[i],
royaltyAmount,
royaltyRecipient,
royaltyPaid
);
} else {
// Purchase validation failed, refund
_pendingPayments[msg.sender] += prices[i];
}
} catch {
// Purchase execution failed (e.g. NFT transfer reverted), refund
_pendingPayments[msg.sender] += prices[i];
}
} else {
// Listing changed or delisted during execution, refund
_pendingPayments[msg.sender] += prices[i];
}
}
}
function _validateAndList(address nftContract, uint256 tokenId, uint256 price, address seller) private {
require(nftContract != address(0), "Invalid contract address");
require(price > 0, "Price must be > 0");
_validateNFTContract(nftContract);
IERC721 nft = IERC721(nftContract);
require(nft.ownerOf(tokenId) == seller, "Not owner");
require(
nft.isApprovedForAll(seller, address(this)) || nft.getApproved(tokenId) == address(this),
"Not approved"
);
Listing storage listing = listings[nftContract][tokenId];
if (listing.active) {
// When updating existing listing, seller must match
require(listing.seller == seller, "Seller mismatch on update");
emit NFTPriceUpdated(nftContract, tokenId, listing.price, price);
} else {
emit NFTListed(nftContract, tokenId, seller, price);
}
listing.seller = seller;
listing.price = price;
listing.active = true;
}
function _executePurchase(address nftContract, uint256 tokenId)
internal
returns (uint256 royaltyAmount, address royaltyRecipient, bool royaltyPaid)
{
Listing memory listing = listings[nftContract][tokenId];
require(listing.active, "Not listed");
listings[nftContract][tokenId].active = false;
uint256 platformFeeAmount = (listing.price * platformFee) / 10000;
(royaltyRecipient, royaltyAmount) = _getRoyaltyInfo(nftContract, tokenId, listing.price);
uint256 sellerAmount = listing.price - platformFeeAmount;
if (royaltyAmount > 0) {
require(royaltyAmount < sellerAmount, "Royalty too high");
sellerAmount -= royaltyAmount;
}
require(sellerAmount > 0, "Seller amount too low");
// Transfer NFT first (Checks-Effects-Interactions)
IERC721(nftContract).safeTransferFrom(listing.seller, msg.sender, tokenId);
// Payments via pull pattern
_pendingPayments[listing.seller] += sellerAmount;
totalPlatformFees += platformFeeAmount;
// Attempt royalty payment with gas limit to prevent griefing
royaltyPaid = false;
if (royaltyAmount > 0 && royaltyRecipient != address(0)) {
(bool success, ) = royaltyRecipient.call{value: royaltyAmount, gas: 30000}("");
if (success) {
royaltyPaid = true;
} else {
failedRoyalties[royaltyRecipient] += royaltyAmount;
emit RoyaltyPaymentFailed(royaltyRecipient, royaltyAmount);
}
}
delete listings[nftContract][tokenId];
return (royaltyAmount, royaltyRecipient, royaltyPaid);
}
function _getRoyaltyInfo(address nftContract, uint256 tokenId, uint256 price)
private
view
returns (address recipient, uint256 amount)
{
if (ERC165Checker.supportsInterface(nftContract, _INTERFACE_ID_ERC2981)) {
try IERC2981(nftContract).royaltyInfo(tokenId, price) returns (address r, uint256 a) {
if (r != address(0) && a > 0 && a < price) {
return (r, a);
}
} catch {}
}
return (address(0), 0);
}
function _validateNFTContract(address nftContract) private view {
require(
ERC165Checker.supportsInterface(nftContract, _INTERFACE_ID_ERC721),
"Not ERC721"
);
}
function _validateNFTApproval(address nftContract, uint256 tokenId, address seller) private view {
IERC721 nft = IERC721(nftContract);
require(
nft.isApprovedForAll(seller, address(this)) || nft.getApproved(tokenId) == address(this),
"Approval revoked"
);
}
/// @notice Helper function for batch purchases that can be called externally with try-catch
/// @dev This function is external to allow try-catch, but protected by checking msg.sender
function _tryExecutePurchase(address nftContract, uint256 tokenId, uint256 expectedPrice)
external
returns (bool success, uint256 royaltyAmount, address royaltyRecipient, bool royaltyPaid)
{
// Only allow calls from this contract (for batch purchases)
require(msg.sender == address(this), "Internal only");
// Verify price matches expected (prevents price changes during batch)
Listing memory listing = listings[nftContract][tokenId];
if (!listing.active || listing.price != expectedPrice) {
return (false, 0, address(0), false);
}
// Execute purchase - if this reverts, the try-catch will catch it
(royaltyAmount, royaltyRecipient, royaltyPaid) = _executePurchase(nftContract, tokenId);
return (true, royaltyAmount, royaltyRecipient, royaltyPaid);
}
receive() external payable {}
}
/IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)
pragma solidity >=0.4.16;
/**
* @dev Interface of the ERC-165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[ERC].
*
* 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[ERC 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 v5.0.1) (utils/Context.sol)
pragma solidity ^0.8.20;
/**
* @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;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
/
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol)
pragma solidity ^0.8.20;
/**
* @dev Collection of common custom errors used in multiple contracts
*
* IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.
* It is recommended to avoid relying on the error API for critical functionality.
*
* _Available since v5.1._
*/
library Errors {
/**
* @dev The ETH balance of the account is not enough to perform the operation.
*/
error InsufficientBalance(uint256 balance, uint256 needed);
/**
* @dev A call to an address target failed. The target may have reverted.
*/
error FailedCall();
/**
* @dev The deployment failed.
*/
error FailedDeployment();
/**
* @dev A necessary precompile is missing.
*/
error MissingPrecompile(address);
}
/IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC721/IERC721.sol)
pragma solidity >=0.6.2;
import {IERC165} from "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC-721 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 ERC-721 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 ERC-721
* 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 address zero.
*
* 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.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}
/
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../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.
*
* The initial owner is set to the address provided by the deployer. 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;
/**
* @dev The caller account is not authorized to perform an operation.
*/
error OwnableUnauthorizedAccount(address account);
/**
* @dev The owner is not a valid owner account. (eg. `address(0)`)
*/
error OwnableInvalidOwner(address owner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the address provided by the deployer as the initial owner.
*/
constructor(address initialOwner) {
if (initialOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_transferOwnership(initialOwner);
}
/**
* @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 {
if (owner() != _msgSender()) {
revert OwnableUnauthorizedAccount(_msgSender());
}
}
/**
* @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 {
if (newOwner == address(0)) {
revert OwnableInvalidOwner(address(0));
}
_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);
}
}
/ERC165Checker.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/ERC165Checker.sol)
pragma solidity ^0.8.20;
import {IERC165} from "./IERC165.sol";
/**
* @dev Library used to query support of an interface declared via {IERC165}.
*
* Note that these functions return the actual result of the query: they do not
* `revert` if an interface is not supported. It is up to the caller to decide
* what to do in these cases.
*/
library ERC165Checker {
// As per the ERC-165 spec, no interface should ever match 0xffffffff
bytes4 private constant INTERFACE_ID_INVALID = 0xffffffff;
/**
* @dev Returns true if `account` supports the {IERC165} interface.
*/
function supportsERC165(address account) internal view returns (bool) {
// Any contract that implements ERC-165 must explicitly indicate support of
// InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid
return
supportsERC165InterfaceUnchecked(account, type(IERC165).interfaceId) &&
!supportsERC165InterfaceUnchecked(account, INTERFACE_ID_INVALID);
}
/**
* @dev Returns true if `account` supports the interface defined by
* `interfaceId`. Support for {IERC165} itself is queried automatically.
*
* See {IERC165-supportsInterface}.
*/
function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {
// query support of both ERC-165 as per the spec and support of _interfaceId
return supportsERC165(account) && supportsERC165InterfaceUnchecked(account, interfaceId);
}
/**
* @dev Returns a boolean array where each value corresponds to the
* interfaces passed in and whether they're supported or not. This allows
* you to batch check interfaces for a contract where your expectation
* is that some interfaces may not be supported.
*
* See {IERC165-supportsInterface}.
*/
function getSupportedInterfaces(
address account,
bytes4[] memory interfaceIds
) internal view returns (bool[] memory) {
// an array of booleans corresponding to interfaceIds and whether they're supported or not
bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);
// query support of ERC-165 itself
if (supportsERC165(account)) {
// query support of each interface in interfaceIds
for (uint256 i = 0; i < interfaceIds.length; i++) {
interfaceIdsSupported[i] = supportsERC165InterfaceUnchecked(account, interfaceIds[i]);
}
}
return interfaceIdsSupported;
}
/**
* @dev Returns true if `account` supports all the interfaces defined in
* `interfaceIds`. Support for {IERC165} itself is queried automatically.
*
* Batch-querying can lead to gas savings by skipping repeated checks for
* {IERC165} support.
*
* See {IERC165-supportsInterface}.
*/
function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {
// query support of ERC-165 itself
if (!supportsERC165(account)) {
return false;
}
// query support of each interface in interfaceIds
for (uint256 i = 0; i < interfaceIds.length; i++) {
if (!supportsERC165InterfaceUnchecked(account, interfaceIds[i])) {
return false;
}
}
// all interfaces supported
return true;
}
/**
* @notice Query if a contract implements an interface, does not check ERC-165 support
* @param account The address of the contract to query for support of an interface
* @param interfaceId The interface identifier, as specified in ERC-165
* @return true if the contract at account indicates support of the interface with
* identifier interfaceId, false otherwise
* @dev Assumes that account contains a contract that supports ERC-165, otherwise
* the behavior of this method is undefined. This precondition can be checked
* with {supportsERC165}.
*
* Some precompiled contracts will falsely indicate support for a given interface, so caution
* should be exercised when using this function.
*
* Interface identification is specified in ERC-165.
*/
function supportsERC165InterfaceUnchecked(address account, bytes4 interfaceId) internal view returns (bool) {
// prepare call
bytes memory encodedParams = abi.encodeCall(IERC165.supportsInterface, (interfaceId));
// perform static call
bool success;
uint256 returnSize;
uint256 returnValue;
assembly ("memory-safe") {
success := staticcall(30000, account, add(encodedParams, 0x20), mload(encodedParams), 0x00, 0x20)
returnSize := returndatasize()
returnValue := mload(0x00)
}
return success && returnSize >= 0x20 && returnValue > 0;
}
}
/
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/Address.sol)
pragma solidity ^0.8.20;
import {Errors} from "./Errors.sol";
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev There's no code at `target` (it is not a contract).
*/
error AddressEmptyCode(address target);
/**
* @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.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
if (address(this).balance < amount) {
revert Errors.InsufficientBalance(address(this).balance, amount);
}
(bool success, bytes memory returndata) = recipient.call{value: amount}("");
if (!success) {
_revert(returndata);
}
}
/**
* @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 or custom error, it is bubbled
* up by this function (like regular Solidity function calls). However, if
* the call reverted with no returned reason, this function reverts with a
* {Errors.FailedCall} error.
*
* 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.
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0);
}
/**
* @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`.
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
if (address(this).balance < value) {
revert Errors.InsufficientBalance(address(this).balance, value);
}
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
* was not a contract or bubbling up the revert reason (falling back to {Errors.FailedCall}) in case
* of an unsuccessful call.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
// only check if target is a contract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
if (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
/**
* @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
* revert reason or with a default {Errors.FailedCall} error.
*/
function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
return returndata;
}
}
/**
* @dev Reverts with returndata if present. Otherwise reverts with {Errors.FailedCall}.
*/
function _revert(bytes memory returndata) 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
assembly ("memory-safe") {
revert(add(returndata, 0x20), mload(returndata))
}
} else {
revert Errors.FailedCall();
}
}
}
Compiler Settings
{"remappings":[],"optimizer":{"runs":200,"enabled":true},"metadata":{"bytecodeHash":"ipfs"},"libraries":{},"evmVersion":"shanghai","compilationTarget":{"Marketplace.sol":"NFTMarketplace"}}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"error","name":"OwnableInvalidOwner","inputs":[{"type":"address","name":"owner","internalType":"address"}]},{"type":"error","name":"OwnableUnauthorizedAccount","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"event","name":"BatchPurchaseRefund","inputs":[{"type":"address","name":"buyer","internalType":"address","indexed":true},{"type":"uint256","name":"refundAmount","internalType":"uint256","indexed":false},{"type":"uint256","name":"failedItems","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"BatchPurchased","inputs":[{"type":"uint256","name":"itemCount","internalType":"uint256","indexed":false},{"type":"uint256","name":"successfulCount","internalType":"uint256","indexed":false},{"type":"uint256","name":"totalSpent","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"NFTDelisted","inputs":[{"type":"address","name":"nftContract","internalType":"address","indexed":true},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true},{"type":"address","name":"seller","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"NFTListed","inputs":[{"type":"address","name":"nftContract","internalType":"address","indexed":true},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true},{"type":"address","name":"seller","internalType":"address","indexed":false},{"type":"uint256","name":"price","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"NFTPriceUpdated","inputs":[{"type":"address","name":"nftContract","internalType":"address","indexed":true},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true},{"type":"uint256","name":"oldPrice","internalType":"uint256","indexed":false},{"type":"uint256","name":"newPrice","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"NFTSold","inputs":[{"type":"address","name":"nftContract","internalType":"address","indexed":true},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true},{"type":"address","name":"buyer","internalType":"address","indexed":false},{"type":"uint256","name":"price","internalType":"uint256","indexed":false},{"type":"uint256","name":"royaltyAmount","internalType":"uint256","indexed":false},{"type":"address","name":"royaltyRecipient","internalType":"address","indexed":false},{"type":"bool","name":"royaltyPaid","internalType":"bool","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Paused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"PaymentReleased","inputs":[{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"PlatformFeeUpdated","inputs":[{"type":"uint256","name":"newFee","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"RoyaltyClaimed","inputs":[{"type":"address","name":"recipient","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"RoyaltyPaymentFailed","inputs":[{"type":"address","name":"recipient","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Unpaused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"MAX_FEE","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"success","internalType":"bool"},{"type":"uint256","name":"royaltyAmount","internalType":"uint256"},{"type":"address","name":"royaltyRecipient","internalType":"address"},{"type":"bool","name":"royaltyPaid","internalType":"bool"}],"name":"_tryExecutePurchase","inputs":[{"type":"address","name":"nftContract","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"expectedPrice","internalType":"uint256"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"batchBuyNFTs","inputs":[{"type":"address[]","name":"nftContracts","internalType":"address[]"},{"type":"uint256[]","name":"tokenIds","internalType":"uint256[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"batchDelistNFTs","inputs":[{"type":"address[]","name":"nftContracts","internalType":"address[]"},{"type":"uint256[]","name":"tokenIds","internalType":"uint256[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"batchListNFTs","inputs":[{"type":"address[]","name":"nftContracts","internalType":"address[]"},{"type":"uint256[]","name":"tokenIds","internalType":"uint256[]"},{"type":"uint256[]","name":"prices","internalType":"uint256[]"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"buyNFT","inputs":[{"type":"address","name":"nftContract","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claimFailedRoyalty","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"delistNFT","inputs":[{"type":"address","name":"nftContract","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"failedRoyalties","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"seller","internalType":"address"},{"type":"uint256","name":"price","internalType":"uint256"},{"type":"bool","name":"active","internalType":"bool"}],"name":"getListing","inputs":[{"type":"address","name":"nftContract","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"listNFT","inputs":[{"type":"address","name":"nftContract","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"seller","internalType":"address"},{"type":"uint256","name":"price","internalType":"uint256"},{"type":"bool","name":"active","internalType":"bool"}],"name":"listings","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"pause","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"paused","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"pendingPayment","inputs":[{"type":"address","name":"payee","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"platformFee","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalPlatformFees","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unpause","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updatePlatformFee","inputs":[{"type":"uint256","name":"newFee","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updatePrice","inputs":[{"type":"address","name":"nftContract","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"newPrice","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawPayments","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawPlatformFees","inputs":[]},{"type":"receive","stateMutability":"payable"}]
Contract Creation Code
0x60806040526045600555348015610014575f80fd5b5060015f55338061003e57604051631e4fbdf760e01b81525f600482015260240160405180910390fd5b6100478161004d565b5061009e565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b612a0080620000ac5f395ff3fe608060405260043610610163575f3560e01c80638da5cb5b116100cd578063aeae177c11610087578063d0b7830b11610062578063d0b7830b146104ba578063d3631fa5146104ce578063e57d6fb7146104e3578063f2fde38b14610502575f80fd5b8063aeae177c1461041f578063bc063e1a14610453578063c75d3c2c14610468575f80fd5b80638da5cb5b14610375578063a02008d81461039c578063a17a7094146103af578063a82ba76f146103ce578063aa0b5988146103e1578063ad05f1b414610400575f80fd5b80634dd9b1a11161011e5780634dd9b1a1146102815780635c975abb146102a05780636103d70b146102c9578063715018a6146102dd5780638456cb59146102f157806388700d1c14610305575f80fd5b806207df301461016e57806326232a2e146101ea5780632af3d3261461020d5780633f4ba83a1461022e57806349f3d053146102425780634d606fdc14610256575f80fd5b3661016a57005b5f80fd5b348015610179575f80fd5b506101be6101883660046125a8565b600260208181525f938452604080852090915291835291208054600182015491909201546001600160a01b039092169160ff1683565b604080516001600160a01b03909416845260208401929092521515908201526060015b60405180910390f35b3480156101f5575f80fd5b506101ff60055481565b6040519081526020016101e1565b348015610218575f80fd5b5061022c61022736600461261a565b610521565b005b348015610239575f80fd5b5061022c6106fc565b34801561024d575f80fd5b5061022c610747565b348015610261575f80fd5b506101ff610270366004612681565b60046020525f908152604090205481565b34801561028c575f80fd5b5061022c61029b3660046126a3565b610851565b3480156102ab575f80fd5b50600154600160a01b900460ff1660405190151581526020016101e1565b3480156102d4575f80fd5b5061022c61095e565b3480156102e8575f80fd5b5061022c610a55565b3480156102fc575f80fd5b5061022c610a66565b348015610310575f80fd5b506101be61031f3660046125a8565b6001600160a01b038083165f90815260026020818152604080842086855282529283902083516060810185528154909516808652600182015492860183905292015460ff16151593909201839052919250925092565b348015610380575f80fd5b506001546040516001600160a01b0390911681526020016101e1565b61022c6103aa36600461261a565b610ab1565b3480156103ba575f80fd5b5061022c6103c93660046125a8565b610ca3565b61022c6103dc3660046125a8565b610dc2565b3480156103ec575f80fd5b5061022c6103fb366004612736565b610f4a565b34801561040b575f80fd5b5061022c61041a36600461274d565b610fce565b34801561042a575f80fd5b506101ff610439366004612681565b6001600160a01b03165f9081526003602052604090205490565b34801561045e575f80fd5b506101ff61017181565b348015610473575f80fd5b5061048761048236600461274d565b61101a565b6040516101e19493929190931515845260208401929092526001600160a01b031660408301521515606082015260800190565b3480156104c5575f80fd5b5061022c6110f1565b3480156104d9575f80fd5b506101ff60065481565b3480156104ee575f80fd5b5061022c6104fd36600461274d565b6111fb565b34801561050d575f80fd5b5061022c61051c366004612681565b6113f1565b61052961142e565b600154600160a01b900460ff161561055c5760405162461bcd60e51b81526004016105539061277f565b60405180910390fd5b82811461057b5760405162461bcd60e51b8152600401610553906127a8565b601483111561059c5760405162461bcd60e51b8152600401610553906127d1565b5f5b838110156106ec575f60025f8787858181106105bc576105bc6127fa565b90506020020160208101906105d19190612681565b6001600160a01b03166001600160a01b031681526020019081526020015f205f858585818110610603576106036127fa565b602090810292909201358352508101919091526040015f20600281015490915060ff16801561063b575080546001600160a01b031633145b6106575760405162461bcd60e51b81526004016105539061280e565b60028101805460ff1916905533848484818110610676576106766127fa565b9050602002013587878581811061068f5761068f6127fa565b90506020020160208101906106a49190612681565b6001600160a01b03167f2701bc311aaa7a88a3c143b24dc4239305023243939a7735e244af9ad209bce260405160405180910390a450806106e481612859565b91505061059e565b506106f660015f55565b50505050565b610704611485565b6001805460ff60a01b191690556040513381527f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa906020015b60405180910390a1565b61074f61142e565b335f908152600460205260409020548061079a5760405162461bcd60e51b815260206004820152600c60248201526b4e6f20726f79616c7469657360a01b6044820152606401610553565b335f818152600460205260408082208290555190919083908381818185875af1925050503d805f81146107e8576040519150601f19603f3d011682016040523d82523d5f602084013e6107ed565b606091505b505090508061080e5760405162461bcd60e51b815260040161055390612871565b60405182815233907f4dde06d146f45c5901140b17cd6e3c65b3767f374b735f91bdf1bcff9e649c7a906020015b60405180910390a2505061084f60015f55565b565b61085961142e565b600154600160a01b900460ff16156108835760405162461bcd60e51b81526004016105539061277f565b848314801561089157508481145b6108ad5760405162461bcd60e51b8152600401610553906127a8565b60148511156108ce5760405162461bcd60e51b8152600401610553906127d1565b5f5b8581101561094c5761093a8787838181106108ed576108ed6127fa565b90506020020160208101906109029190612681565b868684818110610914576109146127fa565b9050602002013585858581811061092d5761092d6127fa565b90506020020135336114b2565b8061094481612859565b9150506108d0565b5061095660015f55565b505050505050565b61096661142e565b335f90815260036020526040902054806109af5760405162461bcd60e51b815260206004820152600a6024820152694e6f2062616c616e636560b01b6044820152606401610553565b335f818152600360205260408082208290555190919083908381818185875af1925050503d805f81146109fd576040519150601f19603f3d011682016040523d82523d5f602084013e610a02565b606091505b5050905080610a235760405162461bcd60e51b815260040161055390612871565b60405182815233907fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b0569060200161083c565b610a5d611485565b61084f5f61188c565b610a6e611485565b6001805460ff60a01b1916600160a01b1790556040513381527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2589060200161073d565b610ab961142e565b600154600160a01b900460ff1615610ae35760405162461bcd60e51b81526004016105539061277f565b828114610b025760405162461bcd60e51b8152600401610553906127a8565b6014831115610b235760405162461bcd60e51b8152600401610553906127d1565b8280610b5f5760405162461bcd60e51b815260206004820152600b60248201526a08adae0e8f240c4c2e8c6d60ab1b6044820152606401610553565b5f805f610b6e888888886118dd565b92509250925082341015610bbb5760405162461bcd60e51b8152602060048201526014602482015273125b9cdd59999a58da595b9d081c185e5b595b9d60621b6044820152606401610553565b5f80610bcc8a8a8a8a88888c611ae5565b9150915081341115610c53575f610be3833461289a565b335f90815260036020526040812080549293508392909190610c069084906128ad565b909155503390507f335d8cb1f00c5639fe287dd9410b2392abfb36ed32e1d6021cfb6ef0307617f682610c39858b61289a565b6040805192835260208301919091520160405180910390a2505b60408051878152602081018390529081018390527f2f302be5b76d85dcd83f4522f00cc6362f2345d063a8d434947c256eada30a629060600160405180910390a15050505050506106f660015f55565b610cab61142e565b600154600160a01b900460ff1615610cd55760405162461bcd60e51b81526004016105539061277f565b6001600160a01b0382165f9081526002602081815260408084208585529091529091209081015460ff168015610d14575080546001600160a01b031633145b610d305760405162461bcd60e51b81526004016105539061280e565b60028101805460ff19169055604051339083906001600160a01b038616907f2701bc311aaa7a88a3c143b24dc4239305023243939a7735e244af9ad209bce2905f90a4506001600160a01b0382165f908152600260208181526040808420858552909152822080546001600160a01b0319168155600181019290925501805460ff19169055610dbe60015f55565b5050565b610dca61142e565b600154600160a01b900460ff1615610df45760405162461bcd60e51b81526004016105539061277f565b6001600160a01b038083165f908152600260208181526040808420868552825292839020835160608101855281549095168552600181015491850191909152015460ff161515908201819052610e795760405162461bcd60e51b815260206004820152600a602482015269139bdd081b1a5cdd195960b21b6044820152606401610553565b80602001513414610ec55760405162461bcd60e51b8152602060048201526016602482015275115e1858dd081c185e5b595b9d081c995c5d5a5c995960521b6044820152606401610553565b5f805f610ed28686611ef8565b602080880151604080513381529283019190915281018490526001600160a01b0380841660608301528215156080830152939650919450925086918816907f5367cdd98b313077e15ed71c3ae1f86cdda81fa08af95d6f126cf54b0d77b73a9060a00160405180910390a350505050610dbe60015f55565b610f52611485565b610171811115610f935760405162461bcd60e51b815260206004820152600c60248201526b08ccaca40e8dede40d0d2ced60a31b6044820152606401610553565b60058190556040518181527f45610d581145924dd7090a5017e5f2b1d6f42213bb2e95707ff86846bbfcb1ca9060200160405180910390a150565b610fd661142e565b600154600160a01b900460ff16156110005760405162461bcd60e51b81526004016105539061277f565b61100c838383336114b2565b61101560015f55565b505050565b5f80808033301461105d5760405162461bcd60e51b815260206004820152600d60248201526c496e7465726e616c206f6e6c7960981b6044820152606401610553565b6001600160a01b038088165f9081526002602081815260408084208b8552825292839020835160608101855281549095168552600181015491850191909152015460ff1615801591830191909152806110ba575085816020015114155b156110d1575f805f809450945094509450506110e8565b6110db8888611ef8565b6001975091955093509150505b93509350935093565b6110f9611485565b600654806111335760405162461bcd60e51b81526020600482015260076024820152664e6f206665657360c81b6044820152606401610553565b5f60068190556001546040516001600160a01b039091169083908381818185875af1925050503d805f8114611183576040519150601f19603f3d011682016040523d82523d5f602084013e611188565b606091505b50509050806111a95760405162461bcd60e51b815260040161055390612871565b6001546001600160a01b03166001600160a01b03167fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b056836040516111ef91815260200190565b60405180910390a25050565b61120361142e565b600154600160a01b900460ff161561122d5760405162461bcd60e51b81526004016105539061277f565b5f81116112705760405162461bcd60e51b815260206004820152601160248201527005072696365206d757374206265203e203607c1b6044820152606401610553565b6001600160a01b0383165f9081526002602081815260408084208685529091529091209081015460ff1680156112af575080546001600160a01b031633145b6112cb5760405162461bcd60e51b81526004016105539061280e565b6040516331a9108f60e11b815260048101849052849033906001600160a01b03831690636352211e90602401602060405180830381865afa158015611312573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061133691906128c0565b6001600160a01b0316146113785760405162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b6044820152606401610553565b815461139090869086906001600160a01b031661227e565b83856001600160a01b03167f31efc4cdbdb9bf723bf903afc8e493b63b6de67a8e3d0c0418217ef8e083d0448460010154866040516113d9929190918252602082015260400190565b60405180910390a35060010181905561101560015f55565b6113f9611485565b6001600160a01b03811661142257604051631e4fbdf760e01b81525f6004820152602401610553565b61142b8161188c565b50565b60025f540361147f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610553565b60025f55565b6001546001600160a01b0316331461084f5760405163118cdaa760e01b8152336004820152602401610553565b6001600160a01b0384166115085760405162461bcd60e51b815260206004820152601860248201527f496e76616c696420636f6e7472616374206164647265737300000000000000006044820152606401610553565b5f821161154b5760405162461bcd60e51b815260206004820152601160248201527005072696365206d757374206265203e203607c1b6044820152606401610553565b611554846123a8565b6040516331a9108f60e11b81526004810184905284906001600160a01b038381169190831690636352211e90602401602060405180830381865afa15801561159e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906115c291906128c0565b6001600160a01b0316146116045760405162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b6044820152606401610553565b60405163e985e9c560e01b81526001600160a01b03838116600483015230602483015282169063e985e9c590604401602060405180830381865afa15801561164e573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061167291906128ef565b806116ec575060405163020604bf60e21b81526004810185905230906001600160a01b0383169063081812fc90602401602060405180830381865afa1580156116bd573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906116e191906128c0565b6001600160a01b0316145b6117275760405162461bcd60e51b815260206004820152600c60248201526b139bdd08185c1c1c9bdd995960a21b6044820152606401610553565b6001600160a01b0385165f9081526002602081815260408084208885529091529091209081015460ff16156118085780546001600160a01b038481169116146117b25760405162461bcd60e51b815260206004820152601960248201527f53656c6c6572206d69736d61746368206f6e20757064617465000000000000006044820152606401610553565b84866001600160a01b03167f31efc4cdbdb9bf723bf903afc8e493b63b6de67a8e3d0c0418217ef8e083d0448360010154876040516117fb929190918252602082015260400190565b60405180910390a3611852565b604080516001600160a01b038581168252602082018790528792908916917f392a0f172cb29479635d0b2219b2f96ef24f74dfdf328cb09f1496efe6cfddbe910160405180910390a35b80546001600160a01b0319166001600160a01b039390931692909217825550600180820192909255600201805460ff191690911790555050565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b5f606080858067ffffffffffffffff8111156118fb576118fb612908565b604051908082528060200260200182016040528015611924578160200160208202803683370190505b5092508067ffffffffffffffff81111561194057611940612908565b604051908082528060200260200182016040528015611969578160200160208202803683370190505b5091505f5b81811015611ad9575f60025f8b8b8581811061198c5761198c6127fa565b90506020020160208101906119a19190612681565b6001600160a01b03166001600160a01b031681526020019081526020015f205f8989858181106119d3576119d36127fa565b602090810292909201358352508181019290925260409081015f20815160608101835281546001600160a01b031681526001820154938101939093526002015460ff161515908201819052909150611a665760405162461bcd60e51b815260206004820152601660248201527513db99481bdc881b5bdc99481b9bdd081b1a5cdd195960521b6044820152606401610553565b8060200151858381518110611a7d57611a7d6127fa565b602002602001018181525050805f0151848381518110611a9f57611a9f6127fa565b6001600160a01b03909216602092830291909101820152810151611ac390876128ad565b9550508080611ad190612859565b91505061196e565b50509450945094915050565b5f805f5b83811015611eeb575f60025f8c8c85818110611b0757611b076127fa565b9050602002016020810190611b1c9190612681565b6001600160a01b03166001600160a01b031681526020019081526020015f205f8a8a85818110611b4e57611b4e6127fa565b602090810292909201358352508181019290925260409081015f20815160608101835281546001600160a01b031681526001820154938101939093526002015460ff1615801591830182905291925090611bc45750868281518110611bb557611bb56127fa565b60200260200101518160200151145b8015611bfd5750858281518110611bdd57611bdd6127fa565b60200260200101516001600160a01b0316815f01516001600160a01b0316145b15611e87573063c75d3c2c8c8c85818110611c1a57611c1a6127fa565b9050602002016020810190611c2f9190612681565b8b8b86818110611c4157611c416127fa565b905060200201358a8681518110611c5a57611c5a6127fa565b60209081029190910101516040516001600160e01b031960e086901b1681526001600160a01b039093166004840152602483019190915260448201526064016080604051808303815f875af1925050508015611cd3575060408051601f3d908101601f19168201909252611cd09181019061291c565b60015b611d2d57868281518110611ce957611ce96127fa565b602002602001015160035f336001600160a01b03166001600160a01b031681526020019081526020015f205f828254611d2291906128ad565b90915550611ed89050565b8315611e2d578a8681518110611d4557611d456127fa565b602002602001015188611d5891906128ad565b975086611d6481612859565b9750508c8c87818110611d7957611d796127fa565b905060200201358f8f88818110611d9257611d926127fa565b9050602002016020810190611da79190612681565b6001600160a01b03167f5367cdd98b313077e15ed71c3ae1f86cdda81fa08af95d6f126cf54b0d77b73a338e8a81518110611de457611de46127fa565b602090810291909101810151604080516001600160a01b0394851681529283019190915281018890529086166060820152841515608082015260a00160405180910390a3611e7e565b8a8681518110611e3f57611e3f6127fa565b602002602001015160035f336001600160a01b03166001600160a01b031681526020019081526020015f205f828254611e7891906128ad565b90915550505b50505050611ed8565b868281518110611e9957611e996127fa565b602002602001015160035f336001600160a01b03166001600160a01b031681526020019081526020015f205f828254611ed291906128ad565b90915550505b5080611ee381612859565b915050611ae9565b5097509795505050505050565b6001600160a01b038083165f908152600260208181526040808420868552825280842081516060810183528154909616865260018101549286019290925291015460ff16151590830181905290918291829190611f845760405162461bcd60e51b815260206004820152600a602482015269139bdd081b1a5cdd195960b21b6044820152606401610553565b6001600160a01b0386165f90815260026020818152604080842089855282528320909101805460ff191690556005549083015161271091611fc491612968565b611fce919061297f565b9050611fdf878784602001516123f2565b60208401519096509094505f90611ff790839061289a565b9050851561204e578086106120415760405162461bcd60e51b815260206004820152601060248201526f0a4def2c2d8e8f240e8dede40d0d2ced60831b6044820152606401610553565b61204b868261289a565b90505b5f81116120955760405162461bcd60e51b815260206004820152601560248201527453656c6c657220616d6f756e7420746f6f206c6f7760581b6044820152606401610553565b8251604051632142170760e11b81526001600160a01b03918216600482015233602482015260448101899052908916906342842e0e906064015f604051808303815f87803b1580156120e5575f80fd5b505af11580156120f7573d5f803e3d5ffd5b505084516001600160a01b03165f90815260036020526040812080548594509092506121249084906128ad565b925050819055508160065f82825461213c91906128ad565b909155505f945050851580159061215b57506001600160a01b03851615155b15612233575f856001600160a01b031687617530906040515f60405180830381858888f193505050503d805f81146121ae576040519150601f19603f3d011682016040523d82523d5f602084013e6121b3565b606091505b5050905080156121c65760019450612231565b6001600160a01b0386165f90815260046020526040812080548992906121ed9084906128ad565b90915550506040518781526001600160a01b038716907f89bb601e497bf3f142a2c87b5cdbe55cad753724f3f19d42b3a361eceb4d3cce9060200160405180910390a25b505b5050506001600160a01b0385165f908152600260208181526040808420888552909152822080546001600160a01b0319168155600181019290925501805460ff191690559250925092565b60405163e985e9c560e01b81526001600160a01b03828116600483015230602483015284919082169063e985e9c590604401602060405180830381865afa1580156122cb573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906122ef91906128ef565b80612369575060405163020604bf60e21b81526004810184905230906001600160a01b0383169063081812fc90602401602060405180830381865afa15801561233a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061235e91906128c0565b6001600160a01b0316145b6106f65760405162461bcd60e51b815260206004820152601060248201526f105c1c1c9bdd985b081c995d9bdad95960821b6044820152606401610553565b6123b9816380ac58cd60e01b6124b8565b61142b5760405162461bcd60e51b815260206004820152600a6024820152694e6f742045524337323160b01b6044820152606401610553565b5f806124058563152a902d60e11b6124b8565b156124aa5760405163152a902d60e11b815260048101859052602481018490526001600160a01b03861690632a55205a906044016040805180830381865afa925050508015612471575060408051601f3d908101601f1916820190925261246e9181019061299e565b60015b156124aa576001600160a01b0382161580159061248d57505f81115b801561249857508481105b156124a75790925090506124b0565b50505b505f9050805b935093915050565b5f6124c2836124dc565b80156124d357506124d3838361250e565b90505b92915050565b5f6124ee826301ffc9a760e01b61250e565b80156124d65750612507826001600160e01b031961250e565b1592915050565b6040516001600160e01b0319821660248201525f90819060440160408051601f19818403018152919052602080820180516001600160e01b03166301ffc9a760e01b17815282519293505f9283928392909183918a617530fa92503d91505f51905082801561257e575060208210155b801561258957505f81115b979650505050505050565b6001600160a01b038116811461142b575f80fd5b5f80604083850312156125b9575f80fd5b82356125c481612594565b946020939093013593505050565b5f8083601f8401126125e2575f80fd5b50813567ffffffffffffffff8111156125f9575f80fd5b6020830191508360208260051b8501011115612613575f80fd5b9250929050565b5f805f806040858703121561262d575f80fd5b843567ffffffffffffffff80821115612644575f80fd5b612650888389016125d2565b90965094506020870135915080821115612668575f80fd5b50612675878288016125d2565b95989497509550505050565b5f60208284031215612691575f80fd5b813561269c81612594565b9392505050565b5f805f805f80606087890312156126b8575f80fd5b863567ffffffffffffffff808211156126cf575f80fd5b6126db8a838b016125d2565b909850965060208901359150808211156126f3575f80fd5b6126ff8a838b016125d2565b90965094506040890135915080821115612717575f80fd5b5061272489828a016125d2565b979a9699509497509295939492505050565b5f60208284031215612746575f80fd5b5035919050565b5f805f6060848603121561275f575f80fd5b833561276a81612594565b95602085013595506040909401359392505050565b6020808252600f908201526e10dbdb9d1c9858dd081c185d5cd959608a1b604082015260600190565b6020808252600f908201526e098cadccee8d040dad2e6dac2e8c6d608b1b604082015260600190565b6020808252600f908201526e426174636820746f6f206c6172676560881b604082015260600190565b634e487b7160e01b5f52603260045260245ffd5b60208082526018908201527f4e6f742073656c6c6572206f72206e6f74206163746976650000000000000000604082015260600190565b634e487b7160e01b5f52601160045260245ffd5b5f6001820161286a5761286a612845565b5060010190565b6020808252600f908201526e151c985b9cd9995c8819985a5b1959608a1b604082015260600190565b818103818111156124d6576124d6612845565b808201808211156124d6576124d6612845565b5f602082840312156128d0575f80fd5b815161269c81612594565b805180151581146128ea575f80fd5b919050565b5f602082840312156128ff575f80fd5b6124d3826128db565b634e487b7160e01b5f52604160045260245ffd5b5f805f806080858703121561292f575f80fd5b612938856128db565b935060208501519250604085015161294f81612594565b915061295d606086016128db565b905092959194509250565b80820281158282048414176124d6576124d6612845565b5f8261299957634e487b7160e01b5f52601260045260245ffd5b500490565b5f80604083850312156129af575f80fd5b82516129ba81612594565b602093909301519294929350505056fea2646970667358221220e49bf861fd793e1f9c31c1729dca5879b5fd5e120d4be19328d4cffa2221e9eb64736f6c63430008140033
Deployed ByteCode
0x608060405260043610610163575f3560e01c80638da5cb5b116100cd578063aeae177c11610087578063d0b7830b11610062578063d0b7830b146104ba578063d3631fa5146104ce578063e57d6fb7146104e3578063f2fde38b14610502575f80fd5b8063aeae177c1461041f578063bc063e1a14610453578063c75d3c2c14610468575f80fd5b80638da5cb5b14610375578063a02008d81461039c578063a17a7094146103af578063a82ba76f146103ce578063aa0b5988146103e1578063ad05f1b414610400575f80fd5b80634dd9b1a11161011e5780634dd9b1a1146102815780635c975abb146102a05780636103d70b146102c9578063715018a6146102dd5780638456cb59146102f157806388700d1c14610305575f80fd5b806207df301461016e57806326232a2e146101ea5780632af3d3261461020d5780633f4ba83a1461022e57806349f3d053146102425780634d606fdc14610256575f80fd5b3661016a57005b5f80fd5b348015610179575f80fd5b506101be6101883660046125a8565b600260208181525f938452604080852090915291835291208054600182015491909201546001600160a01b039092169160ff1683565b604080516001600160a01b03909416845260208401929092521515908201526060015b60405180910390f35b3480156101f5575f80fd5b506101ff60055481565b6040519081526020016101e1565b348015610218575f80fd5b5061022c61022736600461261a565b610521565b005b348015610239575f80fd5b5061022c6106fc565b34801561024d575f80fd5b5061022c610747565b348015610261575f80fd5b506101ff610270366004612681565b60046020525f908152604090205481565b34801561028c575f80fd5b5061022c61029b3660046126a3565b610851565b3480156102ab575f80fd5b50600154600160a01b900460ff1660405190151581526020016101e1565b3480156102d4575f80fd5b5061022c61095e565b3480156102e8575f80fd5b5061022c610a55565b3480156102fc575f80fd5b5061022c610a66565b348015610310575f80fd5b506101be61031f3660046125a8565b6001600160a01b038083165f90815260026020818152604080842086855282529283902083516060810185528154909516808652600182015492860183905292015460ff16151593909201839052919250925092565b348015610380575f80fd5b506001546040516001600160a01b0390911681526020016101e1565b61022c6103aa36600461261a565b610ab1565b3480156103ba575f80fd5b5061022c6103c93660046125a8565b610ca3565b61022c6103dc3660046125a8565b610dc2565b3480156103ec575f80fd5b5061022c6103fb366004612736565b610f4a565b34801561040b575f80fd5b5061022c61041a36600461274d565b610fce565b34801561042a575f80fd5b506101ff610439366004612681565b6001600160a01b03165f9081526003602052604090205490565b34801561045e575f80fd5b506101ff61017181565b348015610473575f80fd5b5061048761048236600461274d565b61101a565b6040516101e19493929190931515845260208401929092526001600160a01b031660408301521515606082015260800190565b3480156104c5575f80fd5b5061022c6110f1565b3480156104d9575f80fd5b506101ff60065481565b3480156104ee575f80fd5b5061022c6104fd36600461274d565b6111fb565b34801561050d575f80fd5b5061022c61051c366004612681565b6113f1565b61052961142e565b600154600160a01b900460ff161561055c5760405162461bcd60e51b81526004016105539061277f565b60405180910390fd5b82811461057b5760405162461bcd60e51b8152600401610553906127a8565b601483111561059c5760405162461bcd60e51b8152600401610553906127d1565b5f5b838110156106ec575f60025f8787858181106105bc576105bc6127fa565b90506020020160208101906105d19190612681565b6001600160a01b03166001600160a01b031681526020019081526020015f205f858585818110610603576106036127fa565b602090810292909201358352508101919091526040015f20600281015490915060ff16801561063b575080546001600160a01b031633145b6106575760405162461bcd60e51b81526004016105539061280e565b60028101805460ff1916905533848484818110610676576106766127fa565b9050602002013587878581811061068f5761068f6127fa565b90506020020160208101906106a49190612681565b6001600160a01b03167f2701bc311aaa7a88a3c143b24dc4239305023243939a7735e244af9ad209bce260405160405180910390a450806106e481612859565b91505061059e565b506106f660015f55565b50505050565b610704611485565b6001805460ff60a01b191690556040513381527f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa906020015b60405180910390a1565b61074f61142e565b335f908152600460205260409020548061079a5760405162461bcd60e51b815260206004820152600c60248201526b4e6f20726f79616c7469657360a01b6044820152606401610553565b335f818152600460205260408082208290555190919083908381818185875af1925050503d805f81146107e8576040519150601f19603f3d011682016040523d82523d5f602084013e6107ed565b606091505b505090508061080e5760405162461bcd60e51b815260040161055390612871565b60405182815233907f4dde06d146f45c5901140b17cd6e3c65b3767f374b735f91bdf1bcff9e649c7a906020015b60405180910390a2505061084f60015f55565b565b61085961142e565b600154600160a01b900460ff16156108835760405162461bcd60e51b81526004016105539061277f565b848314801561089157508481145b6108ad5760405162461bcd60e51b8152600401610553906127a8565b60148511156108ce5760405162461bcd60e51b8152600401610553906127d1565b5f5b8581101561094c5761093a8787838181106108ed576108ed6127fa565b90506020020160208101906109029190612681565b868684818110610914576109146127fa565b9050602002013585858581811061092d5761092d6127fa565b90506020020135336114b2565b8061094481612859565b9150506108d0565b5061095660015f55565b505050505050565b61096661142e565b335f90815260036020526040902054806109af5760405162461bcd60e51b815260206004820152600a6024820152694e6f2062616c616e636560b01b6044820152606401610553565b335f818152600360205260408082208290555190919083908381818185875af1925050503d805f81146109fd576040519150601f19603f3d011682016040523d82523d5f602084013e610a02565b606091505b5050905080610a235760405162461bcd60e51b815260040161055390612871565b60405182815233907fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b0569060200161083c565b610a5d611485565b61084f5f61188c565b610a6e611485565b6001805460ff60a01b1916600160a01b1790556040513381527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2589060200161073d565b610ab961142e565b600154600160a01b900460ff1615610ae35760405162461bcd60e51b81526004016105539061277f565b828114610b025760405162461bcd60e51b8152600401610553906127a8565b6014831115610b235760405162461bcd60e51b8152600401610553906127d1565b8280610b5f5760405162461bcd60e51b815260206004820152600b60248201526a08adae0e8f240c4c2e8c6d60ab1b6044820152606401610553565b5f805f610b6e888888886118dd565b92509250925082341015610bbb5760405162461bcd60e51b8152602060048201526014602482015273125b9cdd59999a58da595b9d081c185e5b595b9d60621b6044820152606401610553565b5f80610bcc8a8a8a8a88888c611ae5565b9150915081341115610c53575f610be3833461289a565b335f90815260036020526040812080549293508392909190610c069084906128ad565b909155503390507f335d8cb1f00c5639fe287dd9410b2392abfb36ed32e1d6021cfb6ef0307617f682610c39858b61289a565b6040805192835260208301919091520160405180910390a2505b60408051878152602081018390529081018390527f2f302be5b76d85dcd83f4522f00cc6362f2345d063a8d434947c256eada30a629060600160405180910390a15050505050506106f660015f55565b610cab61142e565b600154600160a01b900460ff1615610cd55760405162461bcd60e51b81526004016105539061277f565b6001600160a01b0382165f9081526002602081815260408084208585529091529091209081015460ff168015610d14575080546001600160a01b031633145b610d305760405162461bcd60e51b81526004016105539061280e565b60028101805460ff19169055604051339083906001600160a01b038616907f2701bc311aaa7a88a3c143b24dc4239305023243939a7735e244af9ad209bce2905f90a4506001600160a01b0382165f908152600260208181526040808420858552909152822080546001600160a01b0319168155600181019290925501805460ff19169055610dbe60015f55565b5050565b610dca61142e565b600154600160a01b900460ff1615610df45760405162461bcd60e51b81526004016105539061277f565b6001600160a01b038083165f908152600260208181526040808420868552825292839020835160608101855281549095168552600181015491850191909152015460ff161515908201819052610e795760405162461bcd60e51b815260206004820152600a602482015269139bdd081b1a5cdd195960b21b6044820152606401610553565b80602001513414610ec55760405162461bcd60e51b8152602060048201526016602482015275115e1858dd081c185e5b595b9d081c995c5d5a5c995960521b6044820152606401610553565b5f805f610ed28686611ef8565b602080880151604080513381529283019190915281018490526001600160a01b0380841660608301528215156080830152939650919450925086918816907f5367cdd98b313077e15ed71c3ae1f86cdda81fa08af95d6f126cf54b0d77b73a9060a00160405180910390a350505050610dbe60015f55565b610f52611485565b610171811115610f935760405162461bcd60e51b815260206004820152600c60248201526b08ccaca40e8dede40d0d2ced60a31b6044820152606401610553565b60058190556040518181527f45610d581145924dd7090a5017e5f2b1d6f42213bb2e95707ff86846bbfcb1ca9060200160405180910390a150565b610fd661142e565b600154600160a01b900460ff16156110005760405162461bcd60e51b81526004016105539061277f565b61100c838383336114b2565b61101560015f55565b505050565b5f80808033301461105d5760405162461bcd60e51b815260206004820152600d60248201526c496e7465726e616c206f6e6c7960981b6044820152606401610553565b6001600160a01b038088165f9081526002602081815260408084208b8552825292839020835160608101855281549095168552600181015491850191909152015460ff1615801591830191909152806110ba575085816020015114155b156110d1575f805f809450945094509450506110e8565b6110db8888611ef8565b6001975091955093509150505b93509350935093565b6110f9611485565b600654806111335760405162461bcd60e51b81526020600482015260076024820152664e6f206665657360c81b6044820152606401610553565b5f60068190556001546040516001600160a01b039091169083908381818185875af1925050503d805f8114611183576040519150601f19603f3d011682016040523d82523d5f602084013e611188565b606091505b50509050806111a95760405162461bcd60e51b815260040161055390612871565b6001546001600160a01b03166001600160a01b03167fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b056836040516111ef91815260200190565b60405180910390a25050565b61120361142e565b600154600160a01b900460ff161561122d5760405162461bcd60e51b81526004016105539061277f565b5f81116112705760405162461bcd60e51b815260206004820152601160248201527005072696365206d757374206265203e203607c1b6044820152606401610553565b6001600160a01b0383165f9081526002602081815260408084208685529091529091209081015460ff1680156112af575080546001600160a01b031633145b6112cb5760405162461bcd60e51b81526004016105539061280e565b6040516331a9108f60e11b815260048101849052849033906001600160a01b03831690636352211e90602401602060405180830381865afa158015611312573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061133691906128c0565b6001600160a01b0316146113785760405162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b6044820152606401610553565b815461139090869086906001600160a01b031661227e565b83856001600160a01b03167f31efc4cdbdb9bf723bf903afc8e493b63b6de67a8e3d0c0418217ef8e083d0448460010154866040516113d9929190918252602082015260400190565b60405180910390a35060010181905561101560015f55565b6113f9611485565b6001600160a01b03811661142257604051631e4fbdf760e01b81525f6004820152602401610553565b61142b8161188c565b50565b60025f540361147f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610553565b60025f55565b6001546001600160a01b0316331461084f5760405163118cdaa760e01b8152336004820152602401610553565b6001600160a01b0384166115085760405162461bcd60e51b815260206004820152601860248201527f496e76616c696420636f6e7472616374206164647265737300000000000000006044820152606401610553565b5f821161154b5760405162461bcd60e51b815260206004820152601160248201527005072696365206d757374206265203e203607c1b6044820152606401610553565b611554846123a8565b6040516331a9108f60e11b81526004810184905284906001600160a01b038381169190831690636352211e90602401602060405180830381865afa15801561159e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906115c291906128c0565b6001600160a01b0316146116045760405162461bcd60e51b81526020600482015260096024820152682737ba1037bbb732b960b91b6044820152606401610553565b60405163e985e9c560e01b81526001600160a01b03838116600483015230602483015282169063e985e9c590604401602060405180830381865afa15801561164e573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061167291906128ef565b806116ec575060405163020604bf60e21b81526004810185905230906001600160a01b0383169063081812fc90602401602060405180830381865afa1580156116bd573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906116e191906128c0565b6001600160a01b0316145b6117275760405162461bcd60e51b815260206004820152600c60248201526b139bdd08185c1c1c9bdd995960a21b6044820152606401610553565b6001600160a01b0385165f9081526002602081815260408084208885529091529091209081015460ff16156118085780546001600160a01b038481169116146117b25760405162461bcd60e51b815260206004820152601960248201527f53656c6c6572206d69736d61746368206f6e20757064617465000000000000006044820152606401610553565b84866001600160a01b03167f31efc4cdbdb9bf723bf903afc8e493b63b6de67a8e3d0c0418217ef8e083d0448360010154876040516117fb929190918252602082015260400190565b60405180910390a3611852565b604080516001600160a01b038581168252602082018790528792908916917f392a0f172cb29479635d0b2219b2f96ef24f74dfdf328cb09f1496efe6cfddbe910160405180910390a35b80546001600160a01b0319166001600160a01b039390931692909217825550600180820192909255600201805460ff191690911790555050565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b5f606080858067ffffffffffffffff8111156118fb576118fb612908565b604051908082528060200260200182016040528015611924578160200160208202803683370190505b5092508067ffffffffffffffff81111561194057611940612908565b604051908082528060200260200182016040528015611969578160200160208202803683370190505b5091505f5b81811015611ad9575f60025f8b8b8581811061198c5761198c6127fa565b90506020020160208101906119a19190612681565b6001600160a01b03166001600160a01b031681526020019081526020015f205f8989858181106119d3576119d36127fa565b602090810292909201358352508181019290925260409081015f20815160608101835281546001600160a01b031681526001820154938101939093526002015460ff161515908201819052909150611a665760405162461bcd60e51b815260206004820152601660248201527513db99481bdc881b5bdc99481b9bdd081b1a5cdd195960521b6044820152606401610553565b8060200151858381518110611a7d57611a7d6127fa565b602002602001018181525050805f0151848381518110611a9f57611a9f6127fa565b6001600160a01b03909216602092830291909101820152810151611ac390876128ad565b9550508080611ad190612859565b91505061196e565b50509450945094915050565b5f805f5b83811015611eeb575f60025f8c8c85818110611b0757611b076127fa565b9050602002016020810190611b1c9190612681565b6001600160a01b03166001600160a01b031681526020019081526020015f205f8a8a85818110611b4e57611b4e6127fa565b602090810292909201358352508181019290925260409081015f20815160608101835281546001600160a01b031681526001820154938101939093526002015460ff1615801591830182905291925090611bc45750868281518110611bb557611bb56127fa565b60200260200101518160200151145b8015611bfd5750858281518110611bdd57611bdd6127fa565b60200260200101516001600160a01b0316815f01516001600160a01b0316145b15611e87573063c75d3c2c8c8c85818110611c1a57611c1a6127fa565b9050602002016020810190611c2f9190612681565b8b8b86818110611c4157611c416127fa565b905060200201358a8681518110611c5a57611c5a6127fa565b60209081029190910101516040516001600160e01b031960e086901b1681526001600160a01b039093166004840152602483019190915260448201526064016080604051808303815f875af1925050508015611cd3575060408051601f3d908101601f19168201909252611cd09181019061291c565b60015b611d2d57868281518110611ce957611ce96127fa565b602002602001015160035f336001600160a01b03166001600160a01b031681526020019081526020015f205f828254611d2291906128ad565b90915550611ed89050565b8315611e2d578a8681518110611d4557611d456127fa565b602002602001015188611d5891906128ad565b975086611d6481612859565b9750508c8c87818110611d7957611d796127fa565b905060200201358f8f88818110611d9257611d926127fa565b9050602002016020810190611da79190612681565b6001600160a01b03167f5367cdd98b313077e15ed71c3ae1f86cdda81fa08af95d6f126cf54b0d77b73a338e8a81518110611de457611de46127fa565b602090810291909101810151604080516001600160a01b0394851681529283019190915281018890529086166060820152841515608082015260a00160405180910390a3611e7e565b8a8681518110611e3f57611e3f6127fa565b602002602001015160035f336001600160a01b03166001600160a01b031681526020019081526020015f205f828254611e7891906128ad565b90915550505b50505050611ed8565b868281518110611e9957611e996127fa565b602002602001015160035f336001600160a01b03166001600160a01b031681526020019081526020015f205f828254611ed291906128ad565b90915550505b5080611ee381612859565b915050611ae9565b5097509795505050505050565b6001600160a01b038083165f908152600260208181526040808420868552825280842081516060810183528154909616865260018101549286019290925291015460ff16151590830181905290918291829190611f845760405162461bcd60e51b815260206004820152600a602482015269139bdd081b1a5cdd195960b21b6044820152606401610553565b6001600160a01b0386165f90815260026020818152604080842089855282528320909101805460ff191690556005549083015161271091611fc491612968565b611fce919061297f565b9050611fdf878784602001516123f2565b60208401519096509094505f90611ff790839061289a565b9050851561204e578086106120415760405162461bcd60e51b815260206004820152601060248201526f0a4def2c2d8e8f240e8dede40d0d2ced60831b6044820152606401610553565b61204b868261289a565b90505b5f81116120955760405162461bcd60e51b815260206004820152601560248201527453656c6c657220616d6f756e7420746f6f206c6f7760581b6044820152606401610553565b8251604051632142170760e11b81526001600160a01b03918216600482015233602482015260448101899052908916906342842e0e906064015f604051808303815f87803b1580156120e5575f80fd5b505af11580156120f7573d5f803e3d5ffd5b505084516001600160a01b03165f90815260036020526040812080548594509092506121249084906128ad565b925050819055508160065f82825461213c91906128ad565b909155505f945050851580159061215b57506001600160a01b03851615155b15612233575f856001600160a01b031687617530906040515f60405180830381858888f193505050503d805f81146121ae576040519150601f19603f3d011682016040523d82523d5f602084013e6121b3565b606091505b5050905080156121c65760019450612231565b6001600160a01b0386165f90815260046020526040812080548992906121ed9084906128ad565b90915550506040518781526001600160a01b038716907f89bb601e497bf3f142a2c87b5cdbe55cad753724f3f19d42b3a361eceb4d3cce9060200160405180910390a25b505b5050506001600160a01b0385165f908152600260208181526040808420888552909152822080546001600160a01b0319168155600181019290925501805460ff191690559250925092565b60405163e985e9c560e01b81526001600160a01b03828116600483015230602483015284919082169063e985e9c590604401602060405180830381865afa1580156122cb573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906122ef91906128ef565b80612369575060405163020604bf60e21b81526004810184905230906001600160a01b0383169063081812fc90602401602060405180830381865afa15801561233a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061235e91906128c0565b6001600160a01b0316145b6106f65760405162461bcd60e51b815260206004820152601060248201526f105c1c1c9bdd985b081c995d9bdad95960821b6044820152606401610553565b6123b9816380ac58cd60e01b6124b8565b61142b5760405162461bcd60e51b815260206004820152600a6024820152694e6f742045524337323160b01b6044820152606401610553565b5f806124058563152a902d60e11b6124b8565b156124aa5760405163152a902d60e11b815260048101859052602481018490526001600160a01b03861690632a55205a906044016040805180830381865afa925050508015612471575060408051601f3d908101601f1916820190925261246e9181019061299e565b60015b156124aa576001600160a01b0382161580159061248d57505f81115b801561249857508481105b156124a75790925090506124b0565b50505b505f9050805b935093915050565b5f6124c2836124dc565b80156124d357506124d3838361250e565b90505b92915050565b5f6124ee826301ffc9a760e01b61250e565b80156124d65750612507826001600160e01b031961250e565b1592915050565b6040516001600160e01b0319821660248201525f90819060440160408051601f19818403018152919052602080820180516001600160e01b03166301ffc9a760e01b17815282519293505f9283928392909183918a617530fa92503d91505f51905082801561257e575060208210155b801561258957505f81115b979650505050505050565b6001600160a01b038116811461142b575f80fd5b5f80604083850312156125b9575f80fd5b82356125c481612594565b946020939093013593505050565b5f8083601f8401126125e2575f80fd5b50813567ffffffffffffffff8111156125f9575f80fd5b6020830191508360208260051b8501011115612613575f80fd5b9250929050565b5f805f806040858703121561262d575f80fd5b843567ffffffffffffffff80821115612644575f80fd5b612650888389016125d2565b90965094506020870135915080821115612668575f80fd5b50612675878288016125d2565b95989497509550505050565b5f60208284031215612691575f80fd5b813561269c81612594565b9392505050565b5f805f805f80606087890312156126b8575f80fd5b863567ffffffffffffffff808211156126cf575f80fd5b6126db8a838b016125d2565b909850965060208901359150808211156126f3575f80fd5b6126ff8a838b016125d2565b90965094506040890135915080821115612717575f80fd5b5061272489828a016125d2565b979a9699509497509295939492505050565b5f60208284031215612746575f80fd5b5035919050565b5f805f6060848603121561275f575f80fd5b833561276a81612594565b95602085013595506040909401359392505050565b6020808252600f908201526e10dbdb9d1c9858dd081c185d5cd959608a1b604082015260600190565b6020808252600f908201526e098cadccee8d040dad2e6dac2e8c6d608b1b604082015260600190565b6020808252600f908201526e426174636820746f6f206c6172676560881b604082015260600190565b634e487b7160e01b5f52603260045260245ffd5b60208082526018908201527f4e6f742073656c6c6572206f72206e6f74206163746976650000000000000000604082015260600190565b634e487b7160e01b5f52601160045260245ffd5b5f6001820161286a5761286a612845565b5060010190565b6020808252600f908201526e151c985b9cd9995c8819985a5b1959608a1b604082015260600190565b818103818111156124d6576124d6612845565b808201808211156124d6576124d6612845565b5f602082840312156128d0575f80fd5b815161269c81612594565b805180151581146128ea575f80fd5b919050565b5f602082840312156128ff575f80fd5b6124d3826128db565b634e487b7160e01b5f52604160045260245ffd5b5f805f806080858703121561292f575f80fd5b612938856128db565b935060208501519250604085015161294f81612594565b915061295d606086016128db565b905092959194509250565b80820281158282048414176124d6576124d6612845565b5f8261299957634e487b7160e01b5f52601260045260245ffd5b500490565b5f80604083850312156129af575f80fd5b82516129ba81612594565b602093909301519294929350505056fea2646970667358221220e49bf861fd793e1f9c31c1729dca5879b5fd5e120d4be19328d4cffa2221e9eb64736f6c63430008140033