More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 25 from a total of 23,257 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Set Ask Price | 20744626 | 100 days ago | IN | 0 ETH | 0.00012037 | ||||
Create Ask | 20686007 | 108 days ago | IN | 0 ETH | 0.00075416 | ||||
Cancel Ask | 20686004 | 108 days ago | IN | 0 ETH | 0.00026786 | ||||
Cancel Ask | 20686001 | 108 days ago | IN | 0 ETH | 0.0002503 | ||||
Cancel Ask | 20685997 | 108 days ago | IN | 0 ETH | 0.00027645 | ||||
Create Ask | 20593521 | 121 days ago | IN | 0 ETH | 0.00034535 | ||||
Fill Ask | 20592530 | 121 days ago | IN | 0.1 ETH | 0.00032341 | ||||
Create Ask | 20592514 | 121 days ago | IN | 0 ETH | 0.00029438 | ||||
Create Ask | 20591751 | 121 days ago | IN | 0 ETH | 0.00033488 | ||||
Create Ask | 20590818 | 121 days ago | IN | 0 ETH | 0.0001033 | ||||
Create Ask | 20466978 | 139 days ago | IN | 0 ETH | 0.00024408 | ||||
Create Ask | 20466967 | 139 days ago | IN | 0 ETH | 0.00025067 | ||||
Create Ask | 20466961 | 139 days ago | IN | 0 ETH | 0.0002635 | ||||
Cancel Ask | 20451257 | 141 days ago | IN | 0 ETH | 0.00005729 | ||||
Cancel Ask | 20451253 | 141 days ago | IN | 0 ETH | 0.00005401 | ||||
Create Ask | 20359983 | 154 days ago | IN | 0 ETH | 0.00035454 | ||||
Fill Ask | 20296026 | 163 days ago | IN | 0.33 ETH | 0.00020967 | ||||
Create Ask | 20291456 | 163 days ago | IN | 0 ETH | 0.0003014 | ||||
Set Ask Price | 20291004 | 163 days ago | IN | 0 ETH | 0.0002258 | ||||
Create Ask | 20290818 | 163 days ago | IN | 0 ETH | 0.00066366 | ||||
Create Ask | 20289996 | 163 days ago | IN | 0 ETH | 0.0001444 | ||||
Create Ask | 20289963 | 163 days ago | IN | 0 ETH | 0.00014416 | ||||
Create Ask | 20289845 | 163 days ago | IN | 0 ETH | 0.00020602 | ||||
Create Ask | 20289827 | 163 days ago | IN | 0 ETH | 0.00020166 | ||||
Create Ask | 20289817 | 163 days ago | IN | 0 ETH | 0.00020458 |
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|
20592530 | 121 days ago | 0.093 ETH | ||||
20592530 | 121 days ago | 0.007 ETH | ||||
20296026 | 163 days ago | 0.297 ETH | ||||
20296026 | 163 days ago | 0.033 ETH | ||||
20130254 | 186 days ago | 0.297 ETH | ||||
20130254 | 186 days ago | 0.033 ETH | ||||
19895318 | 219 days ago | 0.009 ETH | ||||
19895318 | 219 days ago | 0.001 ETH | ||||
19636548 | 255 days ago | 0.45 ETH | ||||
19636548 | 255 days ago | 0.05 ETH | ||||
19357514 | 294 days ago | 0.1809 ETH | ||||
19357514 | 294 days ago | 0.0201 ETH | ||||
19212395 | 314 days ago | 0.041895 ETH | ||||
19212395 | 314 days ago | 0.003105 ETH | ||||
19212395 | 314 days ago | 0.045 ETH | ||||
19164209 | 321 days ago | 0.072 ETH | ||||
19164209 | 321 days ago | 0.008 ETH | ||||
19162745 | 321 days ago | 0.072 ETH | ||||
19162745 | 321 days ago | 0.008 ETH | ||||
19153307 | 323 days ago | 0.02793 ETH | ||||
19153307 | 323 days ago | 0.00207 ETH | ||||
19153307 | 323 days ago | 0.03 ETH | ||||
19123059 | 327 days ago | 0.072 ETH | ||||
19123059 | 327 days ago | 0.008 ETH | ||||
19122091 | 327 days ago | 0.072 ETH |
Loading...
Loading
Contract Name:
AsksV1_1
Compiler Version
v0.8.10+commit.fc410830
Optimization Enabled:
Yes with 500000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.10; import {ReentrancyGuard} from "@rari-capital/solmate/src/utils/ReentrancyGuard.sol"; import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import {ERC721TransferHelper} from "../../../transferHelpers/ERC721TransferHelper.sol"; import {UniversalExchangeEventV1} from "../../../common/UniversalExchangeEvent/V1/UniversalExchangeEventV1.sol"; import {IncomingTransferSupportV1} from "../../../common/IncomingTransferSupport/V1/IncomingTransferSupportV1.sol"; import {FeePayoutSupportV1} from "../../../common/FeePayoutSupport/FeePayoutSupportV1.sol"; import {ModuleNamingSupportV1} from "../../../common/ModuleNamingSupport/ModuleNamingSupportV1.sol"; /// @title Asks V1.1 /// @author tbtstl <[email protected]> /// @notice This module allows sellers to list an owned ERC-721 token for sale for a given price in a given currency, and allows buyers to purchase from those asks contract AsksV1_1 is ReentrancyGuard, UniversalExchangeEventV1, IncomingTransferSupportV1, FeePayoutSupportV1, ModuleNamingSupportV1 { /// @dev The indicator to pass all remaining gas when paying out royalties uint256 private constant USE_ALL_GAS_FLAG = 0; /// @notice The ZORA ERC-721 Transfer Helper ERC721TransferHelper public immutable erc721TransferHelper; /// @notice The ask for a given NFT, if one exists /// @dev ERC-721 token contract => ERC-721 token ID => Ask mapping(address => mapping(uint256 => Ask)) public askForNFT; /// @notice The metadata for an ask /// @param seller The address of the seller placing the ask /// @param sellerFundsRecipient The address to send funds after the ask is filled /// @param askCurrency The address of the ERC-20, or address(0) for ETH, required to fill the ask /// @param findersFeeBps The fee to the referrer of the ask /// @param askPrice The price to fill the ask struct Ask { address seller; address sellerFundsRecipient; address askCurrency; uint16 findersFeeBps; uint256 askPrice; } /// @notice Emitted when an ask is created /// @param tokenContract The ERC-721 token address of the created ask /// @param tokenId The ERC-721 token ID of the created ask /// @param ask The metadata of the created ask event AskCreated(address indexed tokenContract, uint256 indexed tokenId, Ask ask); /// @notice Emitted when an ask price is updated /// @param tokenContract The ERC-721 token address of the updated ask /// @param tokenId The ERC-721 token ID of the updated ask /// @param ask The metadata of the updated ask event AskPriceUpdated(address indexed tokenContract, uint256 indexed tokenId, Ask ask); /// @notice Emitted when an ask is canceled /// @param tokenContract The ERC-721 token address of the canceled ask /// @param tokenId The ERC-721 token ID of the canceled ask /// @param ask The metadata of the canceled ask event AskCanceled(address indexed tokenContract, uint256 indexed tokenId, Ask ask); /// @notice Emitted when an ask is filled /// @param tokenContract The ERC-721 token address of the filled ask /// @param tokenId The ERC-721 token ID of the filled ask /// @param buyer The buyer address of the filled ask /// @param finder The address of finder who referred the ask /// @param ask The metadata of the filled ask event AskFilled(address indexed tokenContract, uint256 indexed tokenId, address indexed buyer, address finder, Ask ask); /// @param _erc20TransferHelper The ZORA ERC-20 Transfer Helper address /// @param _erc721TransferHelper The ZORA ERC-721 Transfer Helper address /// @param _royaltyEngine The Manifold Royalty Engine address /// @param _protocolFeeSettings The ZoraProtocolFeeSettingsV1 address /// @param _wethAddress The WETH token address constructor( address _erc20TransferHelper, address _erc721TransferHelper, address _royaltyEngine, address _protocolFeeSettings, address _wethAddress ) IncomingTransferSupportV1(_erc20TransferHelper) FeePayoutSupportV1(_royaltyEngine, _protocolFeeSettings, _wethAddress, ERC721TransferHelper(_erc721TransferHelper).ZMM().registrar()) ModuleNamingSupportV1("Asks: v1.1") { erc721TransferHelper = ERC721TransferHelper(_erc721TransferHelper); } // ,-. // `-' // /|\ // | ,------. // / \ |AsksV1| // Caller `--+---' // | createAsk() | // | ----------------> // | | // | | // | ____________________________________________________________ // | ! ALT / Ask already exists for this token? ! // | !_____/ | ! // | ! |----. ! // | ! | | _cancelAsk(_tokenContract, _tokenId) ! // | ! |<---' ! // | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~! // | !~[noop]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~! // | | // | |----. // | | | create ask // | |<---' // | | // | |----. // | | | emit AskCreated() // | |<---' // Caller ,--+---. // ,-. |AsksV1| // `-' `------' // /|\ // | // / \ /// @notice Creates the ask for a given NFT /// @param _tokenContract The address of the ERC-721 token to be sold /// @param _tokenId The ID of the ERC-721 token to be sold /// @param _askPrice The price to fill the ask /// @param _askCurrency The address of the ERC-20 token required to fill, or address(0) for ETH /// @param _sellerFundsRecipient The address to send funds once the ask is filled /// @param _findersFeeBps The bps of the ask price (post-royalties) to be sent to the referrer of the sale function createAsk( address _tokenContract, uint256 _tokenId, uint256 _askPrice, address _askCurrency, address _sellerFundsRecipient, uint16 _findersFeeBps ) external nonReentrant { address tokenOwner = IERC721(_tokenContract).ownerOf(_tokenId); require(msg.sender == tokenOwner || IERC721(_tokenContract).isApprovedForAll(tokenOwner, msg.sender), "createAsk must be token owner or operator"); require(erc721TransferHelper.isModuleApproved(msg.sender), "createAsk must approve AsksV1 module"); require(IERC721(_tokenContract).isApprovedForAll(tokenOwner, address(erc721TransferHelper)), "createAsk must approve ERC721TransferHelper as operator"); require(_findersFeeBps <= 10000, "createAsk finders fee bps must be less than or equal to 10000"); require(_sellerFundsRecipient != address(0), "createAsk must specify _sellerFundsRecipient"); if (askForNFT[_tokenContract][_tokenId].seller != address(0)) { _cancelAsk(_tokenContract, _tokenId); } askForNFT[_tokenContract][_tokenId] = Ask({ seller: tokenOwner, sellerFundsRecipient: _sellerFundsRecipient, askCurrency: _askCurrency, findersFeeBps: _findersFeeBps, askPrice: _askPrice }); emit AskCreated(_tokenContract, _tokenId, askForNFT[_tokenContract][_tokenId]); } // ,-. // `-' // /|\ // | ,------. // / \ |AsksV1| // Caller `--+---' // | setAskPrice() | // | ----------------> // | | // | |----. // | | | update ask price // | |<---' // | | // | |----. // | | | emit AskPriceUpdated() // | |<---' // Caller ,--+---. // ,-. |AsksV1| // `-' `------' // /|\ // | // / \ /// @notice Updates the ask price for a given NFT /// @param _tokenContract The address of the ERC-721 token /// @param _tokenId The ID of the ERC-721 token /// @param _askPrice The ask price to set /// @param _askCurrency The address of the ERC-20 token required to fill, or address(0) for ETH function setAskPrice( address _tokenContract, uint256 _tokenId, uint256 _askPrice, address _askCurrency ) external nonReentrant { Ask storage ask = askForNFT[_tokenContract][_tokenId]; require(ask.seller == msg.sender, "setAskPrice must be seller"); ask.askPrice = _askPrice; ask.askCurrency = _askCurrency; emit AskPriceUpdated(_tokenContract, _tokenId, ask); } // ,-. // `-' // /|\ // | ,------. // / \ |AsksV1| // Caller `--+---' // | cancelAsk() | // | ----------------> // | | // | |----. // | | | emit AskCanceled() // | |<---' // | | // | |----. // | | | delete ask // | |<---' // Caller ,--+---. // ,-. |AsksV1| // `-' `------' // /|\ // | // / \ /// @notice Cancels the ask for a given NFT /// @param _tokenContract The address of the ERC-721 token /// @param _tokenId The ID of the ERC-721 token function cancelAsk(address _tokenContract, uint256 _tokenId) external nonReentrant { require(askForNFT[_tokenContract][_tokenId].seller != address(0), "cancelAsk ask doesn't exist"); address tokenOwner = IERC721(_tokenContract).ownerOf(_tokenId); require(msg.sender == tokenOwner || IERC721(_tokenContract).isApprovedForAll(tokenOwner, msg.sender), "cancelAsk must be token owner or operator"); _cancelAsk(_tokenContract, _tokenId); } // ,-. // `-' // /|\ // | ,------. ,--------------------. // / \ |AsksV1| |ERC721TransferHelper| // Caller `--+---' `---------+----------' // | fillAsk() | | // | ----------------> | // | | | // | |----. | // | | | validate received funds | // | |<---' | // | | | // | |----. | // | | | handle royalty payouts | // | |<---' | // | | | // | | | // | _________________________________________________ | // | ! ALT / finders fee configured for this ask? ! | // | !_____/ | ! | // | ! |----. ! | // | ! | | handle finders fee payout ! | // | ! |<---' ! | // | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~! | // | !~[noop]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~! | // | | | // | |----. // | | | handle seller funds recipient payout // | |<---' // | | | // | | transferFrom() | // | | ----------------------------------------> // | | | // | | |----. // | | | | transfer NFT from seller to buyer // | | |<---' // | | | // | |----. | // | | | emit ExchangeExecuted() | // | |<---' | // | | | // | |----. | // | | | emit AskFilled() | // | |<---' | // | | | // | |----. | // | | | delete ask from contract | // | |<---' | // Caller ,--+---. ,---------+----------. // ,-. |AsksV1| |ERC721TransferHelper| // `-' `------' `--------------------' // /|\ // | // / \ /// @notice Fills the ask for a given NFT, transferring the ETH/ERC-20 to the seller and NFT to the buyer /// @param _tokenContract The address of the ERC-721 token /// @param _tokenId The ID of the ERC-721 token /// @param _fillCurrency The address of the ERC-20 token using to fill, or address(0) for ETH /// @param _fillAmount The amount to fill the ask /// @param _finder The address of the ask referrer function fillAsk( address _tokenContract, uint256 _tokenId, address _fillCurrency, uint256 _fillAmount, address _finder ) external payable nonReentrant { Ask storage ask = askForNFT[_tokenContract][_tokenId]; require(ask.seller != address(0), "fillAsk must be active ask"); require(ask.askCurrency == _fillCurrency, "fillAsk _fillCurrency must match ask currency"); require(ask.askPrice == _fillAmount, "fillAsk _fillAmount must match ask amount"); // Ensure ETH/ERC-20 payment from buyer is valid and take custody _handleIncomingTransfer(ask.askPrice, ask.askCurrency); // Payout respective parties, ensuring royalties are honored (uint256 remainingProfit, ) = _handleRoyaltyPayout(_tokenContract, _tokenId, ask.askPrice, ask.askCurrency, USE_ALL_GAS_FLAG); // Payout optional protocol fee remainingProfit = _handleProtocolFeePayout(remainingProfit, ask.askCurrency); // Payout optional finder fee if (_finder != address(0)) { uint256 findersFee = (remainingProfit * ask.findersFeeBps) / 10000; _handleOutgoingTransfer(_finder, findersFee, ask.askCurrency, USE_ALL_GAS_FLAG); remainingProfit = remainingProfit - findersFee; } // Transfer remaining ETH/ERC-20 to seller _handleOutgoingTransfer(ask.sellerFundsRecipient, remainingProfit, ask.askCurrency, USE_ALL_GAS_FLAG); // Transfer NFT to buyer erc721TransferHelper.transferFrom(_tokenContract, ask.seller, msg.sender, _tokenId); ExchangeDetails memory userAExchangeDetails = ExchangeDetails({tokenContract: _tokenContract, tokenId: _tokenId, amount: 1}); ExchangeDetails memory userBExchangeDetails = ExchangeDetails({tokenContract: ask.askCurrency, tokenId: 0, amount: ask.askPrice}); emit ExchangeExecuted(ask.seller, msg.sender, userAExchangeDetails, userBExchangeDetails); emit AskFilled(_tokenContract, _tokenId, msg.sender, _finder, ask); delete askForNFT[_tokenContract][_tokenId]; } /// @dev Deletes canceled and invalid asks /// @param _tokenContract The address of the ERC-721 token /// @param _tokenId The ID of the ERC-721 token function _cancelAsk(address _tokenContract, uint256 _tokenId) private { emit AskCanceled(_tokenContract, _tokenId, askForNFT[_tokenContract][_tokenId]); delete askForNFT[_tokenContract][_tokenId]; } }
// SPDX-License-Identifier: AGPL-3.0-only pragma solidity >=0.7.0; /// @notice Gas optimized reentrancy protection for smart contracts. /// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/security/ReentrancyGuard.sol) abstract contract ReentrancyGuard { uint256 private reentrancyStatus = 1; modifier nonReentrant() { require(reentrancyStatus == 1, "REENTRANCY"); reentrancyStatus = 2; _; reentrancyStatus = 1; } }
// SPDX-License-Identifier: MIT 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`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.10; import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import {BaseTransferHelper} from "./BaseTransferHelper.sol"; /// @title ERC-721 Transfer Helper /// @author tbtstl <[email protected]> /// @notice This contract provides modules the ability to transfer ZORA user ERC-721s with their permission contract ERC721TransferHelper is BaseTransferHelper { constructor(address _approvalsManager) BaseTransferHelper(_approvalsManager) {} function safeTransferFrom( address _token, address _from, address _to, uint256 _tokenId ) public onlyApprovedModule(_from) { IERC721(_token).safeTransferFrom(_from, _to, _tokenId); } function transferFrom( address _token, address _from, address _to, uint256 _tokenId ) public onlyApprovedModule(_from) { IERC721(_token).transferFrom(_from, _to, _tokenId); } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.10; /// @title UniversalExchangeEvent V1 /// @author kulkarohan <[email protected]> /// @notice This module generalizes indexing of all token exchanges across the protocol contract UniversalExchangeEventV1 { /// @notice A ExchangeDetails object that tracks a token exchange /// @member tokenContract The address of the token contract /// @member tokenId The id of the token /// @member amount The amount of tokens being exchanged struct ExchangeDetails { address tokenContract; uint256 tokenId; uint256 amount; } event ExchangeExecuted(address indexed userA, address indexed userB, ExchangeDetails a, ExchangeDetails b); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.10; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {ERC20TransferHelper} from "../../../transferHelpers/ERC20TransferHelper.sol"; /// @title IncomingTransferSupportV1 /// @author tbtstl <[email protected]> /// @notice This contract extension supports receiving funds from an external user contract IncomingTransferSupportV1 { using SafeERC20 for IERC20; /// @notice The ZORA ERC-20 Transfer Helper ERC20TransferHelper public immutable erc20TransferHelper; constructor(address _erc20TransferHelper) { erc20TransferHelper = ERC20TransferHelper(_erc20TransferHelper); } /// @notice Handle an incoming funds transfer, ensuring the sent amount is valid and the sender is solvent /// @param _amount The amount to be received /// @param _currency The currency to receive funds in, or address(0) for ETH function _handleIncomingTransfer(uint256 _amount, address _currency) internal { if (_currency == address(0)) { require(msg.value >= _amount, "_handleIncomingTransfer msg value less than expected amount"); } else { // We must check the balance that was actually transferred to this contract, // as some tokens impose a transfer fee and would not actually transfer the // full amount to the market, resulting in potentally locked funds IERC20 token = IERC20(_currency); uint256 beforeBalance = token.balanceOf(address(this)); erc20TransferHelper.safeTransferFrom(_currency, msg.sender, address(this), _amount); uint256 afterBalance = token.balanceOf(address(this)); require(beforeBalance + _amount == afterBalance, "_handleIncomingTransfer token transfer call did not transfer expected amount"); } } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.10; import {IRoyaltyEngineV1} from "@manifoldxyz/royalty-registry-solidity/contracts/IRoyaltyEngineV1.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {ERC165Checker} from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol"; import {ZoraProtocolFeeSettings} from "../../auxiliary/ZoraProtocolFeeSettings/ZoraProtocolFeeSettings.sol"; import {OutgoingTransferSupportV1} from "../OutgoingTransferSupport/V1/OutgoingTransferSupportV1.sol"; /// @title FeePayoutSupportV1 /// @author tbtstl <[email protected]> /// @notice This contract extension supports paying out protocol fees and royalties contract FeePayoutSupportV1 is OutgoingTransferSupportV1 { IRoyaltyEngineV1 royaltyEngine; ZoraProtocolFeeSettings immutable protocolFeeSettings; address public immutable registrar; /// @notice Emitted when royalties are paid /// @param tokenContract The ERC-721 token address of the royalty payout /// @param tokenId The ERC-721 token ID of the royalty payout /// @param recipient The recipient address of the royalty /// @param amount The amount paid to the recipient event RoyaltyPayout(address indexed tokenContract, uint256 indexed tokenId, address indexed recipient, uint256 amount); /// @param _royaltyEngine The Manifold Royalty Engine V1 address /// @param _protocolFeeSettings The ZoraProtocolFeeSettingsV1 address /// @param _wethAddress WETH address /// @param _registrarAddress The Registrar address, who can update the royalty engine address constructor( address _royaltyEngine, address _protocolFeeSettings, address _wethAddress, address _registrarAddress ) OutgoingTransferSupportV1(_wethAddress) { royaltyEngine = IRoyaltyEngineV1(_royaltyEngine); protocolFeeSettings = ZoraProtocolFeeSettings(_protocolFeeSettings); registrar = _registrarAddress; } /// @notice Update the address of the Royalty Engine, in case of unexpected update on Manifold's Proxy /// @dev emergency use only – requires a frozen RoyaltyEngineV1 at commit 4ae77a73a8a73a79d628352d206fadae7f8e0f74 /// to be deployed elsewhere, or a contract matching that ABI /// @param _royaltyEngine The address for the new royalty engine function setRoyaltyEngineAddress(address _royaltyEngine) public { require(msg.sender == registrar, "setRoyaltyEngineAddress only registrar"); require( ERC165Checker.supportsInterface(_royaltyEngine, type(IRoyaltyEngineV1).interfaceId), "setRoyaltyEngineAddress must match IRoyaltyEngineV1 interface" ); royaltyEngine = IRoyaltyEngineV1(_royaltyEngine); } /// @notice Pays out protocol fee to protocol fee recipient /// @param _amount the sale amount /// @param _payoutCurrency the currency amount to pay the fee in /// @return remaining funds after paying protocol fee function _handleProtocolFeePayout(uint256 _amount, address _payoutCurrency) internal returns (uint256) { uint256 protocolFee = protocolFeeSettings.getFeeAmount(address(this), _amount); if (protocolFee != 0) { (, address feeRecipient) = protocolFeeSettings.moduleFeeSetting(address(this)); _handleOutgoingTransfer(feeRecipient, protocolFee, _payoutCurrency, 0); return _amount - protocolFee; } else { return _amount; } } /// @notice Pays out royalties for given NFTs /// @param _tokenContract The NFT contract address to get royalty information from /// @param _tokenId, The Token ID to get royalty information from /// @param _amount The total sale amount /// @param _payoutCurrency The ERC-20 token address to payout royalties in, or address(0) for ETH /// @param _gasLimit The gas limit to use when attempting to payout royalties. Uses gasleft() if not provided. /// @return remaining funds after paying out royalties function _handleRoyaltyPayout( address _tokenContract, uint256 _tokenId, uint256 _amount, address _payoutCurrency, uint256 _gasLimit ) internal returns (uint256, bool) { // If no gas limit was provided or provided gas limit greater than gas left, just pass the remaining gas. uint256 gas = (_gasLimit == 0 || _gasLimit > gasleft()) ? gasleft() : _gasLimit; // External call ensuring contract doesn't run out of gas paying royalties try this._handleRoyaltyEnginePayout{gas: gas}(_tokenContract, _tokenId, _amount, _payoutCurrency) returns (uint256 remainingFunds) { // Return remaining amount if royalties payout succeeded return (remainingFunds, true); } catch { // Return initial amount if royalties payout failed return (_amount, false); } } /// @notice Pays out royalties for NFTs based on the information returned by the royalty engine /// @dev This method is external to enable setting a gas limit when called - see `_handleRoyaltyPayout`. /// @param _tokenContract The NFT Contract to get royalty information from /// @param _tokenId, The Token ID to get royalty information from /// @param _amount The total sale amount /// @param _payoutCurrency The ERC-20 token address to payout royalties in, or address(0) for ETH /// @return remaining funds after paying out royalties function _handleRoyaltyEnginePayout( address _tokenContract, uint256 _tokenId, uint256 _amount, address _payoutCurrency ) external payable returns (uint256) { require(msg.sender == address(this), "_handleRoyaltyEnginePayout only self callable"); uint256 remainingAmount = _amount; (address payable[] memory recipients, uint256[] memory amounts) = royaltyEngine.getRoyalty(_tokenContract, _tokenId, _amount); for (uint256 i = 0; i < recipients.length; i++) { // Ensure that we aren't somehow paying out more than we have require(remainingAmount >= amounts[i], "insolvent"); // Payout each royalty recipient _handleOutgoingTransfer(recipients[i], amounts[i], _payoutCurrency, 0); emit RoyaltyPayout(_tokenContract, _tokenId, recipients[i], amounts[i]); remainingAmount -= amounts[i]; } return remainingAmount; } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.10; /// @title Module Naming Support V1 /// @author kulkarohan <[email protected]> /// @notice This contract extension supports naming modules contract ModuleNamingSupportV1 { /// @notice The name of the module string public name; /// @notice Sets the name of a module /// @param _name The module name to set constructor(string memory _name) { name = _name; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.10; import {ZoraModuleManager} from "../ZoraModuleManager.sol"; /// @title Base Transfer Helper /// @author tbtstl <[email protected]> /// @notice This contract provides shared utility for ZORA transfer helpers contract BaseTransferHelper { /// @notice The ZORA Module Manager ZoraModuleManager public immutable ZMM; /// @param _moduleManager The ZORA Module Manager referred to for transfer permissions constructor(address _moduleManager) { require(_moduleManager != address(0), "must set module manager to non-zero address"); ZMM = ZoraModuleManager(_moduleManager); } /// @notice Ensures a user has approved the module they're calling /// @param _user The address of the user modifier onlyApprovedModule(address _user) { require(isModuleApproved(_user), "module has not been approved by user"); _; } /// @notice If a user has approved the module they're calling /// @param _user The address of the user function isModuleApproved(address _user) public view returns (bool) { return ZMM.isModuleApproved(_user, msg.sender); } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.10; import {ZoraProtocolFeeSettings} from "./auxiliary/ZoraProtocolFeeSettings/ZoraProtocolFeeSettings.sol"; /// @title ZoraModuleManager /// @author tbtstl <[email protected]> /// @notice This contract allows users to add & access modules on ZORA V3, plus utilize the ZORA transfer helpers contract ZoraModuleManager { /// @notice The EIP-712 type for a signed approval /// @dev keccak256("SignedApproval(address module,address user,bool approved,uint256 deadline,uint256 nonce)") bytes32 private constant SIGNED_APPROVAL_TYPEHASH = 0x8413132cc7aa5bd2ce1a1b142a3f09e2baeda86addf4f9a5dacd4679f56e7cec; /// @notice the EIP-712 domain separator bytes32 private immutable EIP_712_DOMAIN_SEPARATOR = keccak256( abi.encode( keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(bytes("ZORA")), keccak256(bytes("3")), _chainID(), address(this) ) ); /// @notice The signature nonces for 3rd party module approvals mapping(address => uint256) public sigNonces; /// @notice The registrar address that can register modules address public registrar; /// @notice The module fee NFT contract to mint from upon module registration ZoraProtocolFeeSettings public moduleFeeToken; /// @notice Mapping of each user to module approval in the ZORA registry /// @dev User address => Module address => Approved mapping(address => mapping(address => bool)) public userApprovals; /// @notice A mapping of module addresses to module data mapping(address => bool) public moduleRegistered; modifier onlyRegistrar() { require(msg.sender == registrar, "ZMM::onlyRegistrar must be registrar"); _; } event ModuleRegistered(address indexed module); event ModuleApprovalSet(address indexed user, address indexed module, bool approved); event RegistrarChanged(address indexed newRegistrar); /// @param _registrar The initial registrar for the manager /// @param _feeToken The module fee token contract to mint from upon module registration constructor(address _registrar, address _feeToken) { require(_registrar != address(0), "ZMM::must set registrar to non-zero address"); registrar = _registrar; moduleFeeToken = ZoraProtocolFeeSettings(_feeToken); } /// @notice Returns true if the user has approved a given module, false otherwise /// @param _user The user to check approvals for /// @param _module The module to check approvals for /// @return True if the module has been approved by the user, false otherwise function isModuleApproved(address _user, address _module) external view returns (bool) { return userApprovals[_user][_module]; } // ,-. // `-' // /|\ // | ,-----------------. // / \ |ZoraModuleManager| // Caller `--------+--------' // | setApprovalForModule()| // | ----------------------> // | | // | |----. // | | | set approval for module // | |<---' // | | // | |----. // | | | emit ModuleApprovalSet() // | |<---' // Caller ,--------+--------. // ,-. |ZoraModuleManager| // `-' `-----------------' // /|\ // | // / \ /// @notice Allows a user to set the approval for a given module /// @param _module The module to approve /// @param _approved A boolean, whether or not to approve a module function setApprovalForModule(address _module, bool _approved) public { _setApprovalForModule(_module, msg.sender, _approved); } // ,-. // `-' // /|\ // | ,-----------------. // / \ |ZoraModuleManager| // Caller `--------+--------' // | setBatchApprovalForModule()| // | ---------------------------> // | | // | | // | _____________________________________________________ // | ! LOOP / for each module ! // | !______/ | ! // | ! |----. ! // | ! | | set approval for module ! // | ! |<---' ! // | ! | ! // | ! |----. ! // | ! | | emit ModuleApprovalSet() ! // | ! |<---' ! // | !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~! // Caller ,--------+--------. // ,-. |ZoraModuleManager| // `-' `-----------------' // /|\ // | // / \ /// @notice Sets approvals for multiple modules at once /// @param _modules The list of module addresses to set approvals for /// @param _approved A boolean, whether or not to approve the modules function setBatchApprovalForModules(address[] memory _modules, bool _approved) public { for (uint256 i = 0; i < _modules.length; i++) { _setApprovalForModule(_modules[i], msg.sender, _approved); } } // ,-. // `-' // /|\ // | ,-----------------. // / \ |ZoraModuleManager| // Caller `--------+--------' // | setApprovalForModuleBySig()| // | ---------------------------> // | | // | |----. // | | | recover user address from signature // | |<---' // | | // | |----. // | | | set approval for module // | |<---' // | | // | |----. // | | | emit ModuleApprovalSet() // | |<---' // Caller ,--------+--------. // ,-. |ZoraModuleManager| // `-' `-----------------' // /|\ // | // / \ /// @notice Sets approval for a module given an EIP-712 signature /// @param _module The module to approve /// @param _user The user to approve the module for /// @param _approved A boolean, whether or not to approve a module /// @param _deadline The deadline at which point the given signature expires /// @param _v The 129th byte and chain ID of the signature /// @param _r The first 64 bytes of the signature /// @param _s Bytes 64-128 of the signature function setApprovalForModuleBySig( address _module, address _user, bool _approved, uint256 _deadline, uint8 _v, bytes32 _r, bytes32 _s ) public { require(_deadline == 0 || _deadline >= block.timestamp, "ZMM::setApprovalForModuleBySig deadline expired"); bytes32 digest = keccak256( abi.encodePacked( "\x19\x01", EIP_712_DOMAIN_SEPARATOR, keccak256(abi.encode(SIGNED_APPROVAL_TYPEHASH, _module, _user, _approved, _deadline, sigNonces[_user]++)) ) ); address recoveredAddress = ecrecover(digest, _v, _r, _s); require(recoveredAddress != address(0) && recoveredAddress == _user, "ZMM::setApprovalForModuleBySig invalid signature"); _setApprovalForModule(_module, _user, _approved); } // ,-. // `-' // /|\ // | ,-----------------. ,-----------------------. // / \ |ZoraModuleManager| |ZoraProtocolFeeSettings| // Registrar `--------+--------' `-----------+-----------' // | registerModule() | | // |----------------------->| | // | | | // | ----. | // | | register module | // | <---' | // | | | // | | mint() | // | |------------------------------>| // | | | // | | ----. // | | | mint token to registrar // | | <---' // | | | // | ----. | // | | emit ModuleRegistered() | // | <---' | // Registrar ,--------+--------. ,-----------+-----------. // ,-. |ZoraModuleManager| |ZoraProtocolFeeSettings| // `-' `-----------------' `-----------------------' // /|\ // | // / \ /// @notice Registers a module /// @param _module The address of the module function registerModule(address _module) public onlyRegistrar { require(!moduleRegistered[_module], "ZMM::registerModule module already registered"); moduleRegistered[_module] = true; moduleFeeToken.mint(registrar, _module); emit ModuleRegistered(_module); } // ,-. // `-' // /|\ // | ,-----------------. // / \ |ZoraModuleManager| // Registrar `--------+--------' // | setRegistrar() | // |----------------------->| // | | // | ----. // | | set registrar // | <---' // | | // | ----. // | | emit RegistrarChanged() // | <---' // Registrar ,--------+--------. // ,-. |ZoraModuleManager| // `-' `-----------------' // /|\ // | // / \ /// @notice Sets the registrar for the ZORA Module Manager /// @param _registrar the address of the new registrar function setRegistrar(address _registrar) public onlyRegistrar { require(_registrar != address(0), "ZMM::setRegistrar must set registrar to non-zero address"); registrar = _registrar; emit RegistrarChanged(_registrar); } function _chainID() private view returns (uint256 id) { assembly { id := chainid() } } function _setApprovalForModule( address _module, address _user, bool _approved ) private { require(moduleRegistered[_module], "ZMM::must be registered module"); userApprovals[_user][_module] = _approved; emit ModuleApprovalSet(msg.sender, _module, _approved); } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.10; import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol"; interface IERC721TokenURI { function tokenURI(uint256 tokenId) external view returns (string memory); } /// @title ZoraProtocolFeeSettings /// @author tbtstl <[email protected]> /// @notice This contract allows an optional fee percentage and recipient to be set for individual ZORA modules contract ZoraProtocolFeeSettings is ERC721 { struct FeeSetting { uint16 feeBps; address feeRecipient; } address public metadata; address public owner; address public minter; mapping(address => FeeSetting) public moduleFeeSetting; event MetadataUpdated(address indexed newMetadata); event OwnerUpdated(address indexed newOwner); event ProtocolFeeUpdated(address indexed module, address feeRecipient, uint16 feeBps); // Only allow the module fee owner to access the function modifier onlyModuleOwner(address _module) { uint256 tokenId = moduleToTokenId(_module); require(ownerOf(tokenId) == msg.sender, "onlyModuleOwner"); _; } constructor() ERC721("ZORA Module Fee Switch", "ZORF") { _setOwner(msg.sender); } /// @notice Initialize the Protocol Fee Settings /// @param _minter The address that can mint new NFTs (expected ZoraProposalManager address) function init(address _minter, address _metadata) external { require(msg.sender == owner, "init only owner"); require(minter == address(0), "init already initialized"); minter = _minter; metadata = _metadata; } // ,-. // `-' // /|\ // | ,-----------------------. // / \ |ZoraProtocolFeeSettings| // Minter `-----------+-----------' // | mint() | // | ------------------------>| // | | // | ----. // | | derive token ID from module address // | <---' // | | // | ----. // | | mint token to given address // | <---' // | | // | return token ID | // | <------------------------| // Minter ,-----------+-----------. // ,-. |ZoraProtocolFeeSettings| // `-' `-----------------------' // /|\ // | // / \ /// @notice Mint a new protocol fee setting for a module /// @param _to, the address to send the protocol fee setting token to /// @param _module, the module for which the minted token will represent function mint(address _to, address _module) external returns (uint256) { require(msg.sender == minter, "mint onlyMinter"); uint256 tokenId = moduleToTokenId(_module); _mint(_to, tokenId); return tokenId; } // ,-. // `-' // /|\ // | ,-----------------------. // / \ |ZoraProtocolFeeSettings| // ModuleOwner `-----------+-----------' // | setFeeParams() | // |--------------------------->| // | | // | ----. // | | set fee parameters // | <---' // | | // | ----. // | | emit ProtocolFeeUpdated() // | <---' // ModuleOwner ,-----------+-----------. // ,-. |ZoraProtocolFeeSettings| // `-' `-----------------------' // /|\ // | // / \ /// @notice Sets fee parameters for ZORA protocol. /// @param _module The module to apply the fee settings to /// @param _feeRecipient The fee recipient address to send fees to /// @param _feeBps The bps of transaction value to send to the fee recipient function setFeeParams( address _module, address _feeRecipient, uint16 _feeBps ) external onlyModuleOwner(_module) { require(_feeBps <= 10000, "setFeeParams must set fee <= 100%"); require(_feeRecipient != address(0) || _feeBps == 0, "setFeeParams fee recipient cannot be 0 address if fee is greater than 0"); moduleFeeSetting[_module] = FeeSetting(_feeBps, _feeRecipient); emit ProtocolFeeUpdated(_module, _feeRecipient, _feeBps); } // ,-. // `-' // /|\ // | ,-----------------------. // / \ |ZoraProtocolFeeSettings| // Owner `-----------+-----------' // | setOwner() | // |------------------------>| // | | // | ----. // | | set owner // | <---' // | | // | ----. // | | emit OwnerUpdated() // | <---' // Owner ,-----------+-----------. // ,-. |ZoraProtocolFeeSettings| // `-' `-----------------------' // /|\ // | // / \ /// @notice Sets the owner of the contract /// @param _owner the new owner function setOwner(address _owner) external { require(msg.sender == owner, "setOwner onlyOwner"); _setOwner(_owner); } // ,-. // `-' // /|\ // | ,-----------------------. // / \ |ZoraProtocolFeeSettings| // Owner `-----------+-----------' // | setMetadata() | // |------------------------>| // | | // | ----. // | | set metadata // | <---' // | | // | ----. // | | emit MetadataUpdated() // | <---' // Owner ,-----------+-----------. // ,-. |ZoraProtocolFeeSettings| // `-' `-----------------------' // /|\ // | // / \ function setMetadata(address _metadata) external { require(msg.sender == owner, "setMetadata onlyOwner"); _setMetadata(_metadata); } /// @notice Computes the fee for a given uint256 amount /// @param _module The module to compute the fee for /// @param _amount The amount to compute the fee for /// @return amount to be paid out to the fee recipient function getFeeAmount(address _module, uint256 _amount) external view returns (uint256) { return (_amount * moduleFeeSetting[_module].feeBps) / 10000; } /// @notice returns the module address for a given token ID /// @param _tokenId The token ID function tokenIdToModule(uint256 _tokenId) public pure returns (address) { return address(uint160(_tokenId)); } /// @notice returns the token ID for a given module /// @dev we don't worry about losing the top 20 bytes when going from uint256 -> uint160 since we know token ID must have derived from an address /// @param _module The module address function moduleToTokenId(address _module) public pure returns (uint256) { return uint256(uint160(_module)); } function _setOwner(address _owner) private { owner = _owner; emit OwnerUpdated(_owner); } function _setMetadata(address _metadata) private { metadata = _metadata; emit MetadataUpdated(_metadata); } function tokenURI(uint256 tokenId) public view override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); require(metadata != address(0), "ERC721Metadata: no metadata address"); return IERC721TokenURI(metadata).tokenURI(tokenId); } }
// SPDX-License-Identifier: MIT 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: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
// SPDX-License-Identifier: MIT 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 `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT 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 pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason 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 { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT 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 pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT 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 pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @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 `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, 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 `sender` to `recipient` 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 sender, address recipient, uint256 amount ) external returns (bool); /** * @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); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC20.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; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } 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)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } 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"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @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"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.10; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {BaseTransferHelper} from "./BaseTransferHelper.sol"; /// @title ERC-20 Transfer Helper /// @author tbtstl <[email protected]> /// @notice This contract provides modules the ability to transfer ZORA user ERC-20s with their permission contract ERC20TransferHelper is BaseTransferHelper { using SafeERC20 for IERC20; constructor(address _approvalsManager) BaseTransferHelper(_approvalsManager) {} function safeTransferFrom( address _token, address _from, address _to, uint256 _value ) public onlyApprovedModule(_from) { IERC20(_token).safeTransferFrom(_from, _to, _value); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @author: manifold.xyz import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; /** * @dev Lookup engine interface */ interface IRoyaltyEngineV1 is IERC165 { /** * Get the royalty for a given token (address, id) and value amount. Does not cache the bps/amounts. Caches the spec for a given token address * * @param tokenAddress - The address of the token * @param tokenId - The id of the token * @param value - The value you wish to get the royalty of * * returns Two arrays of equal length, royalty recipients and the corresponding amount each recipient should get */ function getRoyalty(address tokenAddress, uint256 tokenId, uint256 value) external returns(address payable[] memory recipients, uint256[] memory amounts); /** * View only version of getRoyalty * * @param tokenAddress - The address of the token * @param tokenId - The id of the token * @param value - The value you wish to get the royalty of * * returns Two arrays of equal length, royalty recipients and the corresponding amount each recipient should get */ function getRoyaltyView(address tokenAddress, uint256 tokenId, uint256 value) external view returns(address payable[] memory recipients, uint256[] memory amounts); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./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 EIP-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 ERC165 must explicitly indicate support of // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid return _supportsERC165Interface(account, type(IERC165).interfaceId) && !_supportsERC165Interface(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 ERC165 as per the spec and support of _interfaceId return supportsERC165(account) && _supportsERC165Interface(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}. * * _Available since v3.4._ */ 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 ERC165 itself if (supportsERC165(account)) { // query support of each interface in interfaceIds for (uint256 i = 0; i < interfaceIds.length; i++) { interfaceIdsSupported[i] = _supportsERC165Interface(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 ERC165 itself if (!supportsERC165(account)) { return false; } // query support of each interface in _interfaceIds for (uint256 i = 0; i < interfaceIds.length; i++) { if (!_supportsERC165Interface(account, interfaceIds[i])) { return false; } } // all interfaces supported return true; } /** * @notice Query if a contract implements an interface, does not check ERC165 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 ERC165, otherwise * the behavior of this method is undefined. This precondition can be checked * with {supportsERC165}. * Interface identification is specified in ERC-165. */ function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) { bytes memory encodedParams = abi.encodeWithSelector(IERC165.supportsInterface.selector, interfaceId); (bool success, bytes memory result) = account.staticcall{gas: 30000}(encodedParams); if (result.length < 32) return false; return success && abi.decode(result, (bool)); } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.10; import {IWETH} from "../../../interfaces/common/IWETH.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; /// @title OutgoingTransferSupportV1 /// @author tbtstl <[email protected]> /// @notice This contract extension supports paying out funds to an external recipient contract OutgoingTransferSupportV1 { using SafeERC20 for IERC20; IWETH immutable weth; constructor(address _wethAddress) { weth = IWETH(_wethAddress); } /// @notice Handle an outgoing funds transfer /// @dev Wraps ETH in WETH if the receiver cannot receive ETH, noop if the funds to be sent are 0 or recipient is invalid /// @param _dest The destination for the funds /// @param _amount The amount to be sent /// @param _currency The currency to send funds in, or address(0) for ETH /// @param _gasLimit The gas limit to use when attempting a payment (if 0, gasleft() is used) function _handleOutgoingTransfer( address _dest, uint256 _amount, address _currency, uint256 _gasLimit ) internal { if (_amount == 0 || _dest == address(0)) { return; } // If no gas limit was provided or provided gas limit greater than gas left, just use the remaining gas. // Handle ETH payment if (_currency == address(0)) { require(address(this).balance >= _amount, "_handleOutgoingTransfer insolvent"); uint256 gas = (_gasLimit == 0 || _gasLimit > gasleft()) ? gasleft() : _gasLimit; (bool success, ) = _dest.call{value: _amount, gas: gas}(new bytes(0)); // If the ETH transfer fails (sigh), wrap the ETH and try send it as WETH. if (!success) { weth.deposit{value: _amount}(); IERC20(address(weth)).safeTransfer(_dest, _amount); } } else { IERC20(_currency).safeTransfer(_dest, _amount); } } }
// SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.10; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IWETH is IERC20 { function deposit() external payable; function withdraw(uint256 wad) external; }
{ "optimizer": { "enabled": true, "runs": 500000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_erc20TransferHelper","type":"address"},{"internalType":"address","name":"_erc721TransferHelper","type":"address"},{"internalType":"address","name":"_royaltyEngine","type":"address"},{"internalType":"address","name":"_protocolFeeSettings","type":"address"},{"internalType":"address","name":"_wethAddress","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"tokenContract","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"components":[{"internalType":"address","name":"seller","type":"address"},{"internalType":"address","name":"sellerFundsRecipient","type":"address"},{"internalType":"address","name":"askCurrency","type":"address"},{"internalType":"uint16","name":"findersFeeBps","type":"uint16"},{"internalType":"uint256","name":"askPrice","type":"uint256"}],"indexed":false,"internalType":"struct AsksV1_1.Ask","name":"ask","type":"tuple"}],"name":"AskCanceled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"tokenContract","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"components":[{"internalType":"address","name":"seller","type":"address"},{"internalType":"address","name":"sellerFundsRecipient","type":"address"},{"internalType":"address","name":"askCurrency","type":"address"},{"internalType":"uint16","name":"findersFeeBps","type":"uint16"},{"internalType":"uint256","name":"askPrice","type":"uint256"}],"indexed":false,"internalType":"struct AsksV1_1.Ask","name":"ask","type":"tuple"}],"name":"AskCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"tokenContract","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":false,"internalType":"address","name":"finder","type":"address"},{"components":[{"internalType":"address","name":"seller","type":"address"},{"internalType":"address","name":"sellerFundsRecipient","type":"address"},{"internalType":"address","name":"askCurrency","type":"address"},{"internalType":"uint16","name":"findersFeeBps","type":"uint16"},{"internalType":"uint256","name":"askPrice","type":"uint256"}],"indexed":false,"internalType":"struct AsksV1_1.Ask","name":"ask","type":"tuple"}],"name":"AskFilled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"tokenContract","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"components":[{"internalType":"address","name":"seller","type":"address"},{"internalType":"address","name":"sellerFundsRecipient","type":"address"},{"internalType":"address","name":"askCurrency","type":"address"},{"internalType":"uint16","name":"findersFeeBps","type":"uint16"},{"internalType":"uint256","name":"askPrice","type":"uint256"}],"indexed":false,"internalType":"struct AsksV1_1.Ask","name":"ask","type":"tuple"}],"name":"AskPriceUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"userA","type":"address"},{"indexed":true,"internalType":"address","name":"userB","type":"address"},{"components":[{"internalType":"address","name":"tokenContract","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"indexed":false,"internalType":"struct UniversalExchangeEventV1.ExchangeDetails","name":"a","type":"tuple"},{"components":[{"internalType":"address","name":"tokenContract","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"indexed":false,"internalType":"struct UniversalExchangeEventV1.ExchangeDetails","name":"b","type":"tuple"}],"name":"ExchangeExecuted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"tokenContract","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RoyaltyPayout","type":"event"},{"inputs":[{"internalType":"address","name":"_tokenContract","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_payoutCurrency","type":"address"}],"name":"_handleRoyaltyEnginePayout","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"askForNFT","outputs":[{"internalType":"address","name":"seller","type":"address"},{"internalType":"address","name":"sellerFundsRecipient","type":"address"},{"internalType":"address","name":"askCurrency","type":"address"},{"internalType":"uint16","name":"findersFeeBps","type":"uint16"},{"internalType":"uint256","name":"askPrice","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenContract","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"cancelAsk","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenContract","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_askPrice","type":"uint256"},{"internalType":"address","name":"_askCurrency","type":"address"},{"internalType":"address","name":"_sellerFundsRecipient","type":"address"},{"internalType":"uint16","name":"_findersFeeBps","type":"uint16"}],"name":"createAsk","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"erc20TransferHelper","outputs":[{"internalType":"contract ERC20TransferHelper","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"erc721TransferHelper","outputs":[{"internalType":"contract ERC721TransferHelper","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenContract","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address","name":"_fillCurrency","type":"address"},{"internalType":"uint256","name":"_fillAmount","type":"uint256"},{"internalType":"address","name":"_finder","type":"address"}],"name":"fillAsk","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"registrar","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_tokenContract","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_askPrice","type":"uint256"},{"internalType":"address","name":"_askCurrency","type":"address"}],"name":"setAskPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_royaltyEngine","type":"address"}],"name":"setRoyaltyEngineAddress","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
61012060405260016000553480156200001757600080fd5b5060405162003595380380620035958339810160408190526200003a916200024f565b6040518060400160405280600a81526020016941736b733a2076312e3160b01b815250838383876001600160a01b031663e3e606f06040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200009f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000c59190620002cf565b6001600160a01b0316632b20e3976040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000103573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001299190620002cf565b6001600160a01b038a811660805291821660a052600180546001600160a01b0319169483169490941790935590811660c0521660e05280516200017490600290602084019062000190565b5050506001600160a01b03909216610100525062000333915050565b8280546200019e90620002f6565b90600052602060002090601f016020900481019282620001c257600085556200020d565b82601f10620001dd57805160ff19168380011785556200020d565b828001600101855582156200020d579182015b828111156200020d578251825591602001919060010190620001f0565b506200021b9291506200021f565b5090565b5b808211156200021b576000815560010162000220565b6001600160a01b03811681146200024c57600080fd5b50565b600080600080600060a086880312156200026857600080fd5b8551620002758162000236565b6020870151909550620002888162000236565b60408701519094506200029b8162000236565b6060870151909350620002ae8162000236565b6080870151909250620002c18162000236565b809150509295509295909350565b600060208284031215620002e257600080fd5b8151620002ef8162000236565b9392505050565b600181811c908216806200030b57607f821691505b602082108114156200032d57634e487b7160e01b600052602260045260246000fd5b50919050565b60805160a05160c05160e051610100516131ed620003a86000396000818161031001528181610aab0152818161122c015261137c01526000818160fe0152611a22015260008181612174015261221801526000818161243d01526124d501526000818161025b0152611e6901526131ed6000f3fe6080604052600436106100bc5760003560e01c80638f9d325111610074578063b20075331161004e578063b2007533146102be578063b249bb30146102de578063f7cd1d9b146102fe57600080fd5b80638f9d3251146102495780639128c22c1461027d5780639e8471081461029e57600080fd5b806340b80746116100a557806340b8074614610145578063418f065614610167578063622dcbd71461023657600080fd5b806306fdde03146100c15780632b20e397146100ec575b600080fd5b3480156100cd57600080fd5b506100d6610332565b6040516100e39190612aa5565b60405180910390f35b3480156100f857600080fd5b506101207f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100e3565b34801561015157600080fd5b50610165610160366004612b1b565b6103c0565b005b34801561017357600080fd5b506101ec610182366004612b1b565b60036020818152600093845260408085209091529183529120805460018201546002830154929093015473ffffffffffffffffffffffffffffffffffffffff918216938216929182169174010000000000000000000000000000000000000000900461ffff169085565b6040805173ffffffffffffffffffffffffffffffffffffffff96871681529486166020860152929094169183019190915261ffff166060820152608081019190915260a0016100e3565b610165610244366004612b47565b6106b8565b34801561025557600080fd5b506101207f000000000000000000000000000000000000000000000000000000000000000081565b61029061028b366004612ba6565b610ca9565b6040519081526020016100e3565b3480156102aa57600080fd5b506101656102b9366004612c00565b610fb9565b3480156102ca57600080fd5b506101656102d9366004612ba6565b611864565b3480156102ea57600080fd5b506101656102f9366004612c70565b611a0a565b34801561030a57600080fd5b506101207f000000000000000000000000000000000000000000000000000000000000000081565b6002805461033f90612c8d565b80601f016020809104026020016040519081016040528092919081815260200182805461036b90612c8d565b80156103b85780601f1061038d576101008083540402835291602001916103b8565b820191906000526020600020905b81548152906001019060200180831161039b57829003601f168201915b505050505081565b600054600114610431576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600a60248201527f5245454e5452414e43590000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b6002600090815573ffffffffffffffffffffffffffffffffffffffff838116825260036020908152604080842085855290915290912054166104cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f63616e63656c41736b2061736b20646f65736e277420657869737400000000006044820152606401610428565b6040517f6352211e0000000000000000000000000000000000000000000000000000000081526004810182905260009073ffffffffffffffffffffffffffffffffffffffff841690636352211e90602401602060405180830381865afa15801561053d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105619190612ce1565b90503373ffffffffffffffffffffffffffffffffffffffff8216148061061857506040517fe985e9c500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff828116600483015233602483015284169063e985e9c590604401602060405180830381865afa1580156105f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106189190612cfe565b6106a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f63616e63656c41736b206d75737420626520746f6b656e206f776e6572206f7260448201527f206f70657261746f7200000000000000000000000000000000000000000000006064820152608401610428565b6106ae8383611bcc565b5050600160005550565b600054600114610724576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600a60248201527f5245454e5452414e4359000000000000000000000000000000000000000000006044820152606401610428565b6002600090815573ffffffffffffffffffffffffffffffffffffffff808716825260036020908152604080842088855290915290912080549091166107c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f66696c6c41736b206d757374206265206163746976652061736b0000000000006044820152606401610428565b600281015473ffffffffffffffffffffffffffffffffffffffff858116911614610871576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f66696c6c41736b205f66696c6c43757272656e6379206d757374206d6174636860448201527f2061736b2063757272656e6379000000000000000000000000000000000000006064820152608401610428565b82816003015414610904576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f66696c6c41736b205f66696c6c416d6f756e74206d757374206d61746368206160448201527f736b20616d6f756e7400000000000000000000000000000000000000000000006064820152608401610428565b6003810154600282015461092e919073ffffffffffffffffffffffffffffffffffffffff16611ccc565b6003810154600282015460009161095f918991899173ffffffffffffffffffffffffffffffffffffffff168561201f565b50600283015490915061098990829073ffffffffffffffffffffffffffffffffffffffff16612125565b905073ffffffffffffffffffffffffffffffffffffffff831615610a1e576002820154600090612710906109d99074010000000000000000000000000000000000000000900461ffff1684612d4f565b6109e39190612d8c565b6002840154909150610a10908590839073ffffffffffffffffffffffffffffffffffffffff1660006122c5565b610a1a8183612dc7565b9150505b60018201546002830154610a4f9173ffffffffffffffffffffffffffffffffffffffff9081169184911660006122c5565b81546040517f15dacbea00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff89811660048301529182166024820152336044820152606481018890527f0000000000000000000000000000000000000000000000000000000000000000909116906315dacbea90608401600060405180830381600087803b158015610af157600080fd5b505af1158015610b05573d6000803e3d6000fd5b5050604080516060808201835273ffffffffffffffffffffffffffffffffffffffff808d16835260208084018d90526001848601528451928301855260028901548216835260009083015260038801548285015287549351929550909350339216907f1f432c9454edd444f55492be01e3fa82aa88bfa28e120a039be204253c10c36e90610b969086908690612dde565b60405180910390a33373ffffffffffffffffffffffffffffffffffffffff16888a73ffffffffffffffffffffffffffffffffffffffff167f21a9d8e221211780696258a05c6225b1a24f428e2fd4d51708f1ab2be4224d398888604051610bfe929190612e46565b60405180910390a450505073ffffffffffffffffffffffffffffffffffffffff909516600090815260036020818152604080842097845296905294812080547fffffffffffffffffffffffff00000000000000000000000000000000000000009081168255600180830180549092169091556002820180547fffffffffffffffffffff0000000000000000000000000000000000000000000016905595018190559390935550505050565b6000333014610d3a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f5f68616e646c65526f79616c7479456e67696e655061796f7574206f6e6c792060448201527f73656c662063616c6c61626c65000000000000000000000000000000000000006064820152608401610428565b6001546040517ff533b80200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff87811660048301526024820187905260448201869052859260009283929091169063f533b802906064016000604051808303816000875af1158015610dc1573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052610e079190810190612faf565b9150915060005b8251811015610fac57818181518110610e2957610e29613074565b6020026020010151841015610e9a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f696e736f6c76656e7400000000000000000000000000000000000000000000006044820152606401610428565b610ed9838281518110610eaf57610eaf613074565b6020026020010151838381518110610ec957610ec9613074565b60200260200101518860006122c5565b828181518110610eeb57610eeb613074565b602002602001015173ffffffffffffffffffffffffffffffffffffffff16888a73ffffffffffffffffffffffffffffffffffffffff167f866e6ef8682ddf5f1025e64dfdb45527077f7be70fa9ef680b7ffd8cf4ab9c50858581518110610f5457610f54613074565b6020026020010151604051610f6b91815260200190565b60405180910390a4818181518110610f8557610f85613074565b602002602001015184610f989190612dc7565b935080610fa4816130a3565b915050610e0e565b5091979650505050505050565b600054600114611025576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600a60248201527f5245454e5452414e4359000000000000000000000000000000000000000000006044820152606401610428565b600260009081556040517f6352211e0000000000000000000000000000000000000000000000000000000081526004810187905273ffffffffffffffffffffffffffffffffffffffff881690636352211e90602401602060405180830381865afa158015611097573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110bb9190612ce1565b90503373ffffffffffffffffffffffffffffffffffffffff8216148061117257506040517fe985e9c500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff828116600483015233602483015288169063e985e9c590604401602060405180830381865afa15801561114e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111729190612cfe565b6111fe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f63726561746541736b206d75737420626520746f6b656e206f776e6572206f7260448201527f206f70657261746f7200000000000000000000000000000000000000000000006064820152608401610428565b6040517f72d276920000000000000000000000000000000000000000000000000000000081523360048201527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906372d2769290602401602060405180830381865afa158015611288573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ac9190612cfe565b611337576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f63726561746541736b206d75737420617070726f76652041736b735631206d6f60448201527f64756c65000000000000000000000000000000000000000000000000000000006064820152608401610428565b6040517fe985e9c500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82811660048301527f00000000000000000000000000000000000000000000000000000000000000008116602483015288169063e985e9c590604401602060405180830381865afa1580156113cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ef9190612cfe565b61147b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603760248201527f63726561746541736b206d75737420617070726f76652045524337323154726160448201527f6e7366657248656c706572206173206f70657261746f720000000000000000006064820152608401610428565b6127108261ffff161115611511576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603d60248201527f63726561746541736b2066696e646572732066656520627073206d757374206260448201527f65206c657373207468616e206f7220657175616c20746f2031303030300000006064820152608401610428565b73ffffffffffffffffffffffffffffffffffffffff83166115b4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f63726561746541736b206d7573742073706563696679205f73656c6c6572467560448201527f6e6473526563697069656e7400000000000000000000000000000000000000006064820152608401610428565b73ffffffffffffffffffffffffffffffffffffffff87811660009081526003602090815260408083208a845290915290205416156115f6576115f68787611bcc565b6040518060a001604052808273ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1681526020018361ffff16815260200186815250600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600088815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060608201518160020160146101000a81548161ffff021916908361ffff16021790555060808201518160030155905050858773ffffffffffffffffffffffffffffffffffffffff167f5b65b398e1d736436510f4da442eaec71466d2abee0816567088c892c4bcee70600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a815260200190815260200160002060405161184e91906130dc565b60405180910390a3505060016000555050505050565b6000546001146118d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600a60248201527f5245454e5452414e4359000000000000000000000000000000000000000000006044820152606401610428565b6002600090815573ffffffffffffffffffffffffffffffffffffffff808616825260036020908152604080842087855290915290912080549091163314611973576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f73657441736b5072696365206d7573742062652073656c6c65720000000000006044820152606401610428565b600381018390556002810180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8481169190911790915560405185918716907f1a24bcf5290feab70f35cfb4870c294ebf497e608d4262b0ec0debe045008140906119f69085906130dc565b60405180910390a350506001600055505050565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614611acf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f736574526f79616c7479456e67696e6541646472657373206f6e6c792072656760448201527f69737472617200000000000000000000000000000000000000000000000000006064820152608401610428565b611af9817fcb23f8160000000000000000000000000000000000000000000000000000000061252e565b611b85576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603d60248201527f736574526f79616c7479456e67696e6541646472657373206d757374206d617460448201527f63682049526f79616c7479456e67696e65563120696e746572666163650000006064820152608401610428565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b73ffffffffffffffffffffffffffffffffffffffff821660008181526003602090815260408083208584529091529081902090518392917f871956abf85befb7c955eacd40fcabe7e01b1702d75764bf7f54bf481933fd3591611c2f91906130dc565b60405180910390a373ffffffffffffffffffffffffffffffffffffffff909116600090815260036020818152604080842094845293905291812080547fffffffffffffffffffffffff0000000000000000000000000000000000000000908116825560018201805490911690556002810180547fffffffffffffffffffff0000000000000000000000000000000000000000000016905590910155565b73ffffffffffffffffffffffffffffffffffffffff8116611d7b5781341015611d77576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603b60248201527f5f68616e646c65496e636f6d696e675472616e73666572206d73672076616c7560448201527f65206c657373207468616e20657870656374656420616d6f756e7400000000006064820152608401610428565b5050565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152819060009073ffffffffffffffffffffffffffffffffffffffff8316906370a0823190602401602060405180830381865afa158015611dea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e0e9190613130565b6040517fd9fc4b6100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8581166004830152336024830152306044830152606482018790529192507f00000000000000000000000000000000000000000000000000000000000000009091169063d9fc4b6190608401600060405180830381600087803b158015611eaf57600080fd5b505af1158015611ec3573d6000803e3d6000fd5b50506040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000925073ffffffffffffffffffffffffffffffffffffffff851691506370a0823190602401602060405180830381865afa158015611f34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f589190613130565b905080611f658684613149565b14612018576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604c60248201527f5f68616e646c65496e636f6d696e675472616e7366657220746f6b656e20747260448201527f616e736665722063616c6c20646964206e6f74207472616e736665722065787060648201527f656374656420616d6f756e740000000000000000000000000000000000000000608482015260a401610428565b5050505050565b6000808083158061202f57505a84115b612039578361203b565b5a5b6040517f9128c22c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff808b166004830152602482018a905260448201899052871660648201529091503090639128c22c90839060840160206040518083038160008887f1935050505080156120fd575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526120fa91810190613130565b60015b61210e57856000925092505061211b565b92506001915061211b9050565b9550959350505050565b6040517f61b485f600000000000000000000000000000000000000000000000000000000815230600482015260248101839052600090819073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016906361b485f690604401602060405180830381865afa1580156121bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121df9190613130565b905080156122ba576040517f86ab6fb90000000000000000000000000000000000000000000000000000000081523060048201526000907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906386ab6fb9906024016040805180830381865afa158015612273573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122979190613161565b9150506122a781838660006122c5565b6122b18286612dc7565b925050506122bf565b839150505b92915050565b8215806122e6575073ffffffffffffffffffffffffffffffffffffffff8416155b156122f057612528565b73ffffffffffffffffffffffffffffffffffffffff8216612507578247101561239b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f5f68616e646c654f7574676f696e675472616e7366657220696e736f6c76656e60448201527f74000000000000000000000000000000000000000000000000000000000000006064820152608401610428565b60008115806123a957505a82115b6123b357816123b5565b5a5b604080516000808252602082019283905292935073ffffffffffffffffffffffffffffffffffffffff881691849188916123ef919061319b565b600060405180830381858888f193505050503d806000811461242d576040519150601f19603f3d011682016040523d82523d6000602084013e612432565b606091505b5050905080612500577f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0866040518263ffffffff1660e01b81526004016000604051808303818588803b1580156124a357600080fd5b505af11580156124b7573d6000803e3d6000fd5b5061250093505073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016915088905087612551565b5050612528565b61252873ffffffffffffffffffffffffffffffffffffffff83168585612551565b50505050565b6000612539836125e3565b801561254a575061254a8383612647565b9392505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790526125de908490612783565b505050565b600061260f827f01ffc9a700000000000000000000000000000000000000000000000000000000612647565b80156122bf5750612640827fffffffff00000000000000000000000000000000000000000000000000000000612647565b1592915050565b604080517fffffffff00000000000000000000000000000000000000000000000000000000831660248083019190915282518083039091018152604490910182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a7000000000000000000000000000000000000000000000000000000001790529051600091908290819073ffffffffffffffffffffffffffffffffffffffff8716906175309061270190869061319b565b6000604051808303818686fa925050503d806000811461273d576040519150601f19603f3d011682016040523d82523d6000602084013e612742565b606091505b509150915060208151101561275d57600093505050506122bf565b8180156127795750808060200190518101906127799190612cfe565b9695505050505050565b60006127e5826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661288f9092919063ffffffff16565b8051909150156125de57808060200190518101906128039190612cfe565b6125de576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610428565b606061289e84846000856128a6565b949350505050565b606082471015612938576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610428565b843b6129a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610428565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516129c9919061319b565b60006040518083038185875af1925050503d8060008114612a06576040519150601f19603f3d011682016040523d82523d6000602084013e612a0b565b606091505b5091509150612a1b828286612a26565b979650505050505050565b60608315612a3557508161254a565b825115612a455782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104289190612aa5565b60005b83811015612a94578181015183820152602001612a7c565b838111156125285750506000910152565b6020815260008251806020840152612ac4816040850160208701612a79565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b73ffffffffffffffffffffffffffffffffffffffff81168114612b1857600080fd5b50565b60008060408385031215612b2e57600080fd5b8235612b3981612af6565b946020939093013593505050565b600080600080600060a08688031215612b5f57600080fd5b8535612b6a81612af6565b9450602086013593506040860135612b8181612af6565b9250606086013591506080860135612b9881612af6565b809150509295509295909350565b60008060008060808587031215612bbc57600080fd5b8435612bc781612af6565b935060208501359250604085013591506060850135612be581612af6565b939692955090935050565b61ffff81168114612b1857600080fd5b60008060008060008060c08789031215612c1957600080fd5b8635612c2481612af6565b955060208701359450604087013593506060870135612c4281612af6565b92506080870135612c5281612af6565b915060a0870135612c6281612bf0565b809150509295509295509295565b600060208284031215612c8257600080fd5b813561254a81612af6565b600181811c90821680612ca157607f821691505b60208210811415612cdb577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b600060208284031215612cf357600080fd5b815161254a81612af6565b600060208284031215612d1057600080fd5b8151801515811461254a57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612d8757612d87612d20565b500290565b600082612dc2577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b600082821015612dd957612dd9612d20565b500390565b825173ffffffffffffffffffffffffffffffffffffffff168152602080840151908201526040808401519082015260c08101825173ffffffffffffffffffffffffffffffffffffffff16606083015260208301516080830152604083015160a083015261254a565b73ffffffffffffffffffffffffffffffffffffffff83811682528254811660208301526001830154811660408301526002830154908116606083015261ffff60a091821c16608083015260038301549082015260c0810161254a565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715612f1857612f18612ea2565b604052919050565b600067ffffffffffffffff821115612f3a57612f3a612ea2565b5060051b60200190565b600082601f830112612f5557600080fd5b81516020612f6a612f6583612f20565b612ed1565b82815260059290921b84018101918181019086841115612f8957600080fd5b8286015b84811015612fa45780518352918301918301612f8d565b509695505050505050565b60008060408385031215612fc257600080fd5b825167ffffffffffffffff80821115612fda57600080fd5b818501915085601f830112612fee57600080fd5b81516020612ffe612f6583612f20565b82815260059290921b8401810191818101908984111561301d57600080fd5b948201945b8386101561304457855161303581612af6565b82529482019490820190613022565b9188015191965090935050508082111561305d57600080fd5b5061306a85828601612f44565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156130d5576130d5612d20565b5060010190565b815473ffffffffffffffffffffffffffffffffffffffff90811682526001830154811660208301526002830154908116604083015261ffff60a091821c1660608301526003830154608083015281016122bf565b60006020828403121561314257600080fd5b5051919050565b6000821982111561315c5761315c612d20565b500190565b6000806040838503121561317457600080fd5b825161317f81612bf0565b602084015190925061319081612af6565b809150509250929050565b600082516131ad818460208701612a79565b919091019291505056fea2646970667358221220c2df488e96e5cb2fce440e6e1568c6d12696b6fff7f11551645b3e745543406564736f6c634300080a0033000000000000000000000000cca379fdf4beda63c4bb0e2a3179ae62c8716794000000000000000000000000909e9efe4d87d1a6018c2065ae642b6d0447bc910000000000000000000000000385603ab55642cb4dd5de3ae9e306809991804f0000000000000000000000009641169a1374b77e052e1001c5a096c29cd67d35000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Deployed Bytecode
0x6080604052600436106100bc5760003560e01c80638f9d325111610074578063b20075331161004e578063b2007533146102be578063b249bb30146102de578063f7cd1d9b146102fe57600080fd5b80638f9d3251146102495780639128c22c1461027d5780639e8471081461029e57600080fd5b806340b80746116100a557806340b8074614610145578063418f065614610167578063622dcbd71461023657600080fd5b806306fdde03146100c15780632b20e397146100ec575b600080fd5b3480156100cd57600080fd5b506100d6610332565b6040516100e39190612aa5565b60405180910390f35b3480156100f857600080fd5b506101207f000000000000000000000000d1d1d4e36117ab794ec5d4c78cbd3a8904e691d081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100e3565b34801561015157600080fd5b50610165610160366004612b1b565b6103c0565b005b34801561017357600080fd5b506101ec610182366004612b1b565b60036020818152600093845260408085209091529183529120805460018201546002830154929093015473ffffffffffffffffffffffffffffffffffffffff918216938216929182169174010000000000000000000000000000000000000000900461ffff169085565b6040805173ffffffffffffffffffffffffffffffffffffffff96871681529486166020860152929094169183019190915261ffff166060820152608081019190915260a0016100e3565b610165610244366004612b47565b6106b8565b34801561025557600080fd5b506101207f000000000000000000000000cca379fdf4beda63c4bb0e2a3179ae62c871679481565b61029061028b366004612ba6565b610ca9565b6040519081526020016100e3565b3480156102aa57600080fd5b506101656102b9366004612c00565b610fb9565b3480156102ca57600080fd5b506101656102d9366004612ba6565b611864565b3480156102ea57600080fd5b506101656102f9366004612c70565b611a0a565b34801561030a57600080fd5b506101207f000000000000000000000000909e9efe4d87d1a6018c2065ae642b6d0447bc9181565b6002805461033f90612c8d565b80601f016020809104026020016040519081016040528092919081815260200182805461036b90612c8d565b80156103b85780601f1061038d576101008083540402835291602001916103b8565b820191906000526020600020905b81548152906001019060200180831161039b57829003601f168201915b505050505081565b600054600114610431576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600a60248201527f5245454e5452414e43590000000000000000000000000000000000000000000060448201526064015b60405180910390fd5b6002600090815573ffffffffffffffffffffffffffffffffffffffff838116825260036020908152604080842085855290915290912054166104cf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f63616e63656c41736b2061736b20646f65736e277420657869737400000000006044820152606401610428565b6040517f6352211e0000000000000000000000000000000000000000000000000000000081526004810182905260009073ffffffffffffffffffffffffffffffffffffffff841690636352211e90602401602060405180830381865afa15801561053d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105619190612ce1565b90503373ffffffffffffffffffffffffffffffffffffffff8216148061061857506040517fe985e9c500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff828116600483015233602483015284169063e985e9c590604401602060405180830381865afa1580156105f4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106189190612cfe565b6106a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f63616e63656c41736b206d75737420626520746f6b656e206f776e6572206f7260448201527f206f70657261746f7200000000000000000000000000000000000000000000006064820152608401610428565b6106ae8383611bcc565b5050600160005550565b600054600114610724576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600a60248201527f5245454e5452414e4359000000000000000000000000000000000000000000006044820152606401610428565b6002600090815573ffffffffffffffffffffffffffffffffffffffff808716825260036020908152604080842088855290915290912080549091166107c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f66696c6c41736b206d757374206265206163746976652061736b0000000000006044820152606401610428565b600281015473ffffffffffffffffffffffffffffffffffffffff858116911614610871576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f66696c6c41736b205f66696c6c43757272656e6379206d757374206d6174636860448201527f2061736b2063757272656e6379000000000000000000000000000000000000006064820152608401610428565b82816003015414610904576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f66696c6c41736b205f66696c6c416d6f756e74206d757374206d61746368206160448201527f736b20616d6f756e7400000000000000000000000000000000000000000000006064820152608401610428565b6003810154600282015461092e919073ffffffffffffffffffffffffffffffffffffffff16611ccc565b6003810154600282015460009161095f918991899173ffffffffffffffffffffffffffffffffffffffff168561201f565b50600283015490915061098990829073ffffffffffffffffffffffffffffffffffffffff16612125565b905073ffffffffffffffffffffffffffffffffffffffff831615610a1e576002820154600090612710906109d99074010000000000000000000000000000000000000000900461ffff1684612d4f565b6109e39190612d8c565b6002840154909150610a10908590839073ffffffffffffffffffffffffffffffffffffffff1660006122c5565b610a1a8183612dc7565b9150505b60018201546002830154610a4f9173ffffffffffffffffffffffffffffffffffffffff9081169184911660006122c5565b81546040517f15dacbea00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff89811660048301529182166024820152336044820152606481018890527f000000000000000000000000909e9efe4d87d1a6018c2065ae642b6d0447bc91909116906315dacbea90608401600060405180830381600087803b158015610af157600080fd5b505af1158015610b05573d6000803e3d6000fd5b5050604080516060808201835273ffffffffffffffffffffffffffffffffffffffff808d16835260208084018d90526001848601528451928301855260028901548216835260009083015260038801548285015287549351929550909350339216907f1f432c9454edd444f55492be01e3fa82aa88bfa28e120a039be204253c10c36e90610b969086908690612dde565b60405180910390a33373ffffffffffffffffffffffffffffffffffffffff16888a73ffffffffffffffffffffffffffffffffffffffff167f21a9d8e221211780696258a05c6225b1a24f428e2fd4d51708f1ab2be4224d398888604051610bfe929190612e46565b60405180910390a450505073ffffffffffffffffffffffffffffffffffffffff909516600090815260036020818152604080842097845296905294812080547fffffffffffffffffffffffff00000000000000000000000000000000000000009081168255600180830180549092169091556002820180547fffffffffffffffffffff0000000000000000000000000000000000000000000016905595018190559390935550505050565b6000333014610d3a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f5f68616e646c65526f79616c7479456e67696e655061796f7574206f6e6c792060448201527f73656c662063616c6c61626c65000000000000000000000000000000000000006064820152608401610428565b6001546040517ff533b80200000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff87811660048301526024820187905260448201869052859260009283929091169063f533b802906064016000604051808303816000875af1158015610dc1573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052610e079190810190612faf565b9150915060005b8251811015610fac57818181518110610e2957610e29613074565b6020026020010151841015610e9a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f696e736f6c76656e7400000000000000000000000000000000000000000000006044820152606401610428565b610ed9838281518110610eaf57610eaf613074565b6020026020010151838381518110610ec957610ec9613074565b60200260200101518860006122c5565b828181518110610eeb57610eeb613074565b602002602001015173ffffffffffffffffffffffffffffffffffffffff16888a73ffffffffffffffffffffffffffffffffffffffff167f866e6ef8682ddf5f1025e64dfdb45527077f7be70fa9ef680b7ffd8cf4ab9c50858581518110610f5457610f54613074565b6020026020010151604051610f6b91815260200190565b60405180910390a4818181518110610f8557610f85613074565b602002602001015184610f989190612dc7565b935080610fa4816130a3565b915050610e0e565b5091979650505050505050565b600054600114611025576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600a60248201527f5245454e5452414e4359000000000000000000000000000000000000000000006044820152606401610428565b600260009081556040517f6352211e0000000000000000000000000000000000000000000000000000000081526004810187905273ffffffffffffffffffffffffffffffffffffffff881690636352211e90602401602060405180830381865afa158015611097573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110bb9190612ce1565b90503373ffffffffffffffffffffffffffffffffffffffff8216148061117257506040517fe985e9c500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff828116600483015233602483015288169063e985e9c590604401602060405180830381865afa15801561114e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111729190612cfe565b6111fe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f63726561746541736b206d75737420626520746f6b656e206f776e6572206f7260448201527f206f70657261746f7200000000000000000000000000000000000000000000006064820152608401610428565b6040517f72d276920000000000000000000000000000000000000000000000000000000081523360048201527f000000000000000000000000909e9efe4d87d1a6018c2065ae642b6d0447bc9173ffffffffffffffffffffffffffffffffffffffff16906372d2769290602401602060405180830381865afa158015611288573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ac9190612cfe565b611337576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f63726561746541736b206d75737420617070726f76652041736b735631206d6f60448201527f64756c65000000000000000000000000000000000000000000000000000000006064820152608401610428565b6040517fe985e9c500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82811660048301527f000000000000000000000000909e9efe4d87d1a6018c2065ae642b6d0447bc918116602483015288169063e985e9c590604401602060405180830381865afa1580156113cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ef9190612cfe565b61147b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603760248201527f63726561746541736b206d75737420617070726f76652045524337323154726160448201527f6e7366657248656c706572206173206f70657261746f720000000000000000006064820152608401610428565b6127108261ffff161115611511576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603d60248201527f63726561746541736b2066696e646572732066656520627073206d757374206260448201527f65206c657373207468616e206f7220657175616c20746f2031303030300000006064820152608401610428565b73ffffffffffffffffffffffffffffffffffffffff83166115b4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f63726561746541736b206d7573742073706563696679205f73656c6c6572467560448201527f6e6473526563697069656e7400000000000000000000000000000000000000006064820152608401610428565b73ffffffffffffffffffffffffffffffffffffffff87811660009081526003602090815260408083208a845290915290205416156115f6576115f68787611bcc565b6040518060a001604052808273ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1681526020018361ffff16815260200186815250600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600088815260200190815260200160002060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060608201518160020160146101000a81548161ffff021916908361ffff16021790555060808201518160030155905050858773ffffffffffffffffffffffffffffffffffffffff167f5b65b398e1d736436510f4da442eaec71466d2abee0816567088c892c4bcee70600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a815260200190815260200160002060405161184e91906130dc565b60405180910390a3505060016000555050505050565b6000546001146118d0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600a60248201527f5245454e5452414e4359000000000000000000000000000000000000000000006044820152606401610428565b6002600090815573ffffffffffffffffffffffffffffffffffffffff808616825260036020908152604080842087855290915290912080549091163314611973576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f73657441736b5072696365206d7573742062652073656c6c65720000000000006044820152606401610428565b600381018390556002810180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8481169190911790915560405185918716907f1a24bcf5290feab70f35cfb4870c294ebf497e608d4262b0ec0debe045008140906119f69085906130dc565b60405180910390a350506001600055505050565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000d1d1d4e36117ab794ec5d4c78cbd3a8904e691d01614611acf576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f736574526f79616c7479456e67696e6541646472657373206f6e6c792072656760448201527f69737472617200000000000000000000000000000000000000000000000000006064820152608401610428565b611af9817fcb23f8160000000000000000000000000000000000000000000000000000000061252e565b611b85576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603d60248201527f736574526f79616c7479456e67696e6541646472657373206d757374206d617460448201527f63682049526f79616c7479456e67696e65563120696e746572666163650000006064820152608401610428565b600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b73ffffffffffffffffffffffffffffffffffffffff821660008181526003602090815260408083208584529091529081902090518392917f871956abf85befb7c955eacd40fcabe7e01b1702d75764bf7f54bf481933fd3591611c2f91906130dc565b60405180910390a373ffffffffffffffffffffffffffffffffffffffff909116600090815260036020818152604080842094845293905291812080547fffffffffffffffffffffffff0000000000000000000000000000000000000000908116825560018201805490911690556002810180547fffffffffffffffffffff0000000000000000000000000000000000000000000016905590910155565b73ffffffffffffffffffffffffffffffffffffffff8116611d7b5781341015611d77576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603b60248201527f5f68616e646c65496e636f6d696e675472616e73666572206d73672076616c7560448201527f65206c657373207468616e20657870656374656420616d6f756e7400000000006064820152608401610428565b5050565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152819060009073ffffffffffffffffffffffffffffffffffffffff8316906370a0823190602401602060405180830381865afa158015611dea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e0e9190613130565b6040517fd9fc4b6100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8581166004830152336024830152306044830152606482018790529192507f000000000000000000000000cca379fdf4beda63c4bb0e2a3179ae62c87167949091169063d9fc4b6190608401600060405180830381600087803b158015611eaf57600080fd5b505af1158015611ec3573d6000803e3d6000fd5b50506040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000925073ffffffffffffffffffffffffffffffffffffffff851691506370a0823190602401602060405180830381865afa158015611f34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f589190613130565b905080611f658684613149565b14612018576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604c60248201527f5f68616e646c65496e636f6d696e675472616e7366657220746f6b656e20747260448201527f616e736665722063616c6c20646964206e6f74207472616e736665722065787060648201527f656374656420616d6f756e740000000000000000000000000000000000000000608482015260a401610428565b5050505050565b6000808083158061202f57505a84115b612039578361203b565b5a5b6040517f9128c22c00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff808b166004830152602482018a905260448201899052871660648201529091503090639128c22c90839060840160206040518083038160008887f1935050505080156120fd575060408051601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682019092526120fa91810190613130565b60015b61210e57856000925092505061211b565b92506001915061211b9050565b9550959350505050565b6040517f61b485f600000000000000000000000000000000000000000000000000000000815230600482015260248101839052600090819073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000009641169a1374b77e052e1001c5a096c29cd67d3516906361b485f690604401602060405180830381865afa1580156121bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121df9190613130565b905080156122ba576040517f86ab6fb90000000000000000000000000000000000000000000000000000000081523060048201526000907f0000000000000000000000009641169a1374b77e052e1001c5a096c29cd67d3573ffffffffffffffffffffffffffffffffffffffff16906386ab6fb9906024016040805180830381865afa158015612273573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122979190613161565b9150506122a781838660006122c5565b6122b18286612dc7565b925050506122bf565b839150505b92915050565b8215806122e6575073ffffffffffffffffffffffffffffffffffffffff8416155b156122f057612528565b73ffffffffffffffffffffffffffffffffffffffff8216612507578247101561239b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f5f68616e646c654f7574676f696e675472616e7366657220696e736f6c76656e60448201527f74000000000000000000000000000000000000000000000000000000000000006064820152608401610428565b60008115806123a957505a82115b6123b357816123b5565b5a5b604080516000808252602082019283905292935073ffffffffffffffffffffffffffffffffffffffff881691849188916123ef919061319b565b600060405180830381858888f193505050503d806000811461242d576040519150601f19603f3d011682016040523d82523d6000602084013e612432565b606091505b5050905080612500577f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff1663d0e30db0866040518263ffffffff1660e01b81526004016000604051808303818588803b1580156124a357600080fd5b505af11580156124b7573d6000803e3d6000fd5b5061250093505073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216915088905087612551565b5050612528565b61252873ffffffffffffffffffffffffffffffffffffffff83168585612551565b50505050565b6000612539836125e3565b801561254a575061254a8383612647565b9392505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb000000000000000000000000000000000000000000000000000000001790526125de908490612783565b505050565b600061260f827f01ffc9a700000000000000000000000000000000000000000000000000000000612647565b80156122bf5750612640827fffffffff00000000000000000000000000000000000000000000000000000000612647565b1592915050565b604080517fffffffff00000000000000000000000000000000000000000000000000000000831660248083019190915282518083039091018152604490910182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01ffc9a7000000000000000000000000000000000000000000000000000000001790529051600091908290819073ffffffffffffffffffffffffffffffffffffffff8716906175309061270190869061319b565b6000604051808303818686fa925050503d806000811461273d576040519150601f19603f3d011682016040523d82523d6000602084013e612742565b606091505b509150915060208151101561275d57600093505050506122bf565b8180156127795750808060200190518101906127799190612cfe565b9695505050505050565b60006127e5826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661288f9092919063ffffffff16565b8051909150156125de57808060200190518101906128039190612cfe565b6125de576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610428565b606061289e84846000856128a6565b949350505050565b606082471015612938576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610428565b843b6129a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610428565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516129c9919061319b565b60006040518083038185875af1925050503d8060008114612a06576040519150601f19603f3d011682016040523d82523d6000602084013e612a0b565b606091505b5091509150612a1b828286612a26565b979650505050505050565b60608315612a3557508161254a565b825115612a455782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104289190612aa5565b60005b83811015612a94578181015183820152602001612a7c565b838111156125285750506000910152565b6020815260008251806020840152612ac4816040850160208701612a79565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b73ffffffffffffffffffffffffffffffffffffffff81168114612b1857600080fd5b50565b60008060408385031215612b2e57600080fd5b8235612b3981612af6565b946020939093013593505050565b600080600080600060a08688031215612b5f57600080fd5b8535612b6a81612af6565b9450602086013593506040860135612b8181612af6565b9250606086013591506080860135612b9881612af6565b809150509295509295909350565b60008060008060808587031215612bbc57600080fd5b8435612bc781612af6565b935060208501359250604085013591506060850135612be581612af6565b939692955090935050565b61ffff81168114612b1857600080fd5b60008060008060008060c08789031215612c1957600080fd5b8635612c2481612af6565b955060208701359450604087013593506060870135612c4281612af6565b92506080870135612c5281612af6565b915060a0870135612c6281612bf0565b809150509295509295509295565b600060208284031215612c8257600080fd5b813561254a81612af6565b600181811c90821680612ca157607f821691505b60208210811415612cdb577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b600060208284031215612cf357600080fd5b815161254a81612af6565b600060208284031215612d1057600080fd5b8151801515811461254a57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612d8757612d87612d20565b500290565b600082612dc2577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b600082821015612dd957612dd9612d20565b500390565b825173ffffffffffffffffffffffffffffffffffffffff168152602080840151908201526040808401519082015260c08101825173ffffffffffffffffffffffffffffffffffffffff16606083015260208301516080830152604083015160a083015261254a565b73ffffffffffffffffffffffffffffffffffffffff83811682528254811660208301526001830154811660408301526002830154908116606083015261ffff60a091821c16608083015260038301549082015260c0810161254a565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715612f1857612f18612ea2565b604052919050565b600067ffffffffffffffff821115612f3a57612f3a612ea2565b5060051b60200190565b600082601f830112612f5557600080fd5b81516020612f6a612f6583612f20565b612ed1565b82815260059290921b84018101918181019086841115612f8957600080fd5b8286015b84811015612fa45780518352918301918301612f8d565b509695505050505050565b60008060408385031215612fc257600080fd5b825167ffffffffffffffff80821115612fda57600080fd5b818501915085601f830112612fee57600080fd5b81516020612ffe612f6583612f20565b82815260059290921b8401810191818101908984111561301d57600080fd5b948201945b8386101561304457855161303581612af6565b82529482019490820190613022565b9188015191965090935050508082111561305d57600080fd5b5061306a85828601612f44565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156130d5576130d5612d20565b5060010190565b815473ffffffffffffffffffffffffffffffffffffffff90811682526001830154811660208301526002830154908116604083015261ffff60a091821c1660608301526003830154608083015281016122bf565b60006020828403121561314257600080fd5b5051919050565b6000821982111561315c5761315c612d20565b500190565b6000806040838503121561317457600080fd5b825161317f81612bf0565b602084015190925061319081612af6565b809150509250929050565b600082516131ad818460208701612a79565b919091019291505056fea2646970667358221220c2df488e96e5cb2fce440e6e1568c6d12696b6fff7f11551645b3e745543406564736f6c634300080a0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000cca379fdf4beda63c4bb0e2a3179ae62c8716794000000000000000000000000909e9efe4d87d1a6018c2065ae642b6d0447bc910000000000000000000000000385603ab55642cb4dd5de3ae9e306809991804f0000000000000000000000009641169a1374b77e052e1001c5a096c29cd67d35000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
-----Decoded View---------------
Arg [0] : _erc20TransferHelper (address): 0xCCA379FDF4Beda63c4bB0e2A3179Ae62c8716794
Arg [1] : _erc721TransferHelper (address): 0x909e9efE4D87d1a6018C2065aE642b6D0447bc91
Arg [2] : _royaltyEngine (address): 0x0385603ab55642cb4Dd5De3aE9e306809991804f
Arg [3] : _protocolFeeSettings (address): 0x9641169A1374b77E052E1001c5a096C29Cd67d35
Arg [4] : _wethAddress (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
-----Encoded View---------------
5 Constructor Arguments found :
Arg [0] : 000000000000000000000000cca379fdf4beda63c4bb0e2a3179ae62c8716794
Arg [1] : 000000000000000000000000909e9efe4d87d1a6018c2065ae642b6d0447bc91
Arg [2] : 0000000000000000000000000385603ab55642cb4dd5de3ae9e306809991804f
Arg [3] : 0000000000000000000000009641169a1374b77e052e1001c5a096c29cd67d35
Arg [4] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.