ETH Price: $2,495.26 (-2.33%)

Contract

0x0475b2F06a04d1a361B06558d853C84AA043DCD8
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Settle Auction150559752022-07-01 10:07:01846 days ago1656670021IN
0x0475b2F0...AA043DCD8
0 ETH0.0029260620.14254036
Pause150559682022-07-01 10:05:03846 days ago1656669903IN
0x0475b2F0...AA043DCD8
0 ETH0.0008864218.94806719
Create Bid150556012022-07-01 8:41:49846 days ago1656664909IN
0x0475b2F0...AA043DCD8
0.01 ETH0.0018065421.63754386
Settle Current A...150498152022-06-30 10:04:26847 days ago1656583466IN
0x0475b2F0...AA043DCD8
0 ETH0.0088278832.47288136
Add Renderer150498122022-06-30 10:03:48847 days ago1656583428IN
0x0475b2F0...AA043DCD8
0 ETH0.0038171133.34745001
Create Bid150470182022-06-29 21:30:09848 days ago1656538209IN
0x0475b2F0...AA043DCD8
0.012 ETH0.00813659137.83834025
Create Bid150448042022-06-29 11:28:53848 days ago1656502133IN
0x0475b2F0...AA043DCD8
0.0111 ETH0.001616819.36501667
Settle Current A...150417852022-06-28 21:49:51849 days ago1656452991IN
0x0475b2F0...AA043DCD8
0 ETH0.0080134733.71057668
Add Renderer150415892022-06-28 20:59:13849 days ago1656449953IN
0x0475b2F0...AA043DCD8
0 ETH0.0052543645.90365387
Settle Current A...150363152022-06-27 21:12:02850 days ago1656364322IN
0x0475b2F0...AA043DCD8
0 ETH0.0123714852.04358253
Add Beneficiary150363082022-06-27 21:10:58850 days ago1656364258IN
0x0475b2F0...AA043DCD8
0 ETH0.0054719474.27145529
Remove Available...150363042022-06-27 21:09:31850 days ago1656364171IN
0x0475b2F0...AA043DCD8
0 ETH0.0024760.84349985
Add Renderer150362862022-06-27 21:05:07850 days ago1656363907IN
0x0475b2F0...AA043DCD8
0 ETH0.008110683.31132793
Settle Current A...150280222022-06-26 8:06:42851 days ago1656230802IN
0x0475b2F0...AA043DCD8
0 ETH0.0075984931.59365205
Settle Current A...150207902022-06-24 23:34:02853 days ago1656113642IN
0x0475b2F0...AA043DCD8
0 ETH0.0080266833.09780459
Settle Current A...150153482022-06-23 23:11:30854 days ago1656025890IN
0x0475b2F0...AA043DCD8
0 ETH0.0064451921.44695012
Create Bid150135812022-06-23 15:22:03854 days ago1655997723IN
0x0475b2F0...AA043DCD8
0.05 ETH0.0039875347.76004753
Settle Current A...150100142022-06-22 23:09:54855 days ago1655939394IN
0x0475b2F0...AA043DCD8
0 ETH0.0059726124.83343527
Settle Current A...150046722022-06-21 23:07:13856 days ago1655852833IN
0x0475b2F0...AA043DCD8
0 ETH0.0084144533.25844602
Settle Current A...149991422022-06-20 23:05:40857 days ago1655766340IN
0x0475b2F0...AA043DCD8
0 ETH0.0129264151.09215011
Settle Current A...149932632022-06-19 22:52:55858 days ago1655679175IN
0x0475b2F0...AA043DCD8
0 ETH0.0049322316.47141866
Create Bid149907842022-06-19 12:30:10858 days ago1655641810IN
0x0475b2F0...AA043DCD8
0.02 ETH0.0022287426.69444054
Settle Current A...149874802022-06-18 22:41:16859 days ago1655592076IN
0x0475b2F0...AA043DCD8
0 ETH0.0132513352.37641235
Settle Current A...149813562022-06-17 21:20:35860 days ago1655500835IN
0x0475b2F0...AA043DCD8
0 ETH0.0112888837.89323395
Create Bid149796052022-06-17 14:12:47860 days ago1655475167IN
0x0475b2F0...AA043DCD8
0.0111 ETH0.0027361632.77191772
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
150559752022-07-01 10:07:01846 days ago1656670021
0x0475b2F0...AA043DCD8
0.009 ETH
150559752022-07-01 10:07:01846 days ago1656670021
0x0475b2F0...AA043DCD8
0.001 ETH
150498152022-06-30 10:04:26847 days ago1656583466
0x0475b2F0...AA043DCD8
0.0108 ETH
150498152022-06-30 10:04:26847 days ago1656583466
0x0475b2F0...AA043DCD8
0.0012 ETH
150470182022-06-29 21:30:09848 days ago1656538209
0x0475b2F0...AA043DCD8
0.0111 ETH
150153482022-06-23 23:11:30854 days ago1656025890
0x0475b2F0...AA043DCD8
0.045 ETH
150153482022-06-23 23:11:30854 days ago1656025890
0x0475b2F0...AA043DCD8
0.005 ETH
149932632022-06-19 22:52:55858 days ago1655679175
0x0475b2F0...AA043DCD8
0.018 ETH
149932632022-06-19 22:52:55858 days ago1655679175
0x0475b2F0...AA043DCD8
0.002 ETH
149813562022-06-17 21:20:35860 days ago1655500835
0x0475b2F0...AA043DCD8
0.00999 ETH
149813562022-06-17 21:20:35860 days ago1655500835
0x0475b2F0...AA043DCD8
0.00111 ETH
149754292022-06-16 21:03:34861 days ago1655413414
0x0475b2F0...AA043DCD8
0.0225 ETH
149754292022-06-16 21:03:34861 days ago1655413414
0x0475b2F0...AA043DCD8
0.0025 ETH
149695712022-06-15 21:01:15862 days ago1655326875
0x0475b2F0...AA043DCD8
0.045 ETH
149695712022-06-15 21:01:15862 days ago1655326875
0x0475b2F0...AA043DCD8
0.005 ETH
149638162022-06-14 20:58:56863 days ago1655240336
0x0475b2F0...AA043DCD8
0.027 ETH
149638162022-06-14 20:58:56863 days ago1655240336
0x0475b2F0...AA043DCD8
0.003 ETH
149580092022-06-13 20:46:01864 days ago1655153161
0x0475b2F0...AA043DCD8
0.135 ETH
149580092022-06-13 20:46:01864 days ago1655153161
0x0475b2F0...AA043DCD8
0.015 ETH
149573462022-06-13 18:03:04864 days ago1655143384
0x0475b2F0...AA043DCD8
0.1 ETH
149521852022-06-12 20:45:35865 days ago1655066735
0x0475b2F0...AA043DCD8
0.0477 ETH
149521852022-06-12 20:45:35865 days ago1655066735
0x0475b2F0...AA043DCD8
0.0053 ETH
149521202022-06-12 20:30:50865 days ago1655065850
0x0475b2F0...AA043DCD8
0.05 ETH
149503422022-06-12 13:16:33865 days ago1655039793
0x0475b2F0...AA043DCD8
0.01 ETH
149463152022-06-11 20:42:00866 days ago1654980120
0x0475b2F0...AA043DCD8
0.02997 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
PrideModule

Compiler Version
v0.8.12+commit.f00d7308

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion, GNU GPLv3 license
File 1 of 34 : PrideModule.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.6;

import {EnumerableSet} from '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';
import {Strings} from '@openzeppelin/contracts/utils/Strings.sol';

import {INFModule, NFBaseModule, ERC165, IERC165} from '@0xdievardump/niftyforge/contracts/Modules/NFBaseModule.sol';
import {INFModuleTokenURI} from '@0xdievardump/niftyforge/contracts/Modules/INFModuleTokenURI.sol';
import {INFModuleWithRoyalties} from '@0xdievardump/niftyforge/contracts/Modules/INFModuleWithRoyalties.sol';
import {INiftyForge721} from '@0xdievardump/niftyforge/contracts/INiftyForge721.sol';

import {IBokkyPooBahsDateTimeContract} from './interfaces/IBokkyPooBahsDateTimeContract.sol';
import {NiftyPrideAuctionHouse} from './NiftyPrideAuctionHouse.sol';
import {IRenderer} from './Renderers/IRenderer.sol';
import {Base64} from './utils/Base64.sol';

contract PrideModule is
    NFBaseModule,
    INFModuleTokenURI,
    INFModuleWithRoyalties,
    NiftyPrideAuctionHouse
{
    using EnumerableSet for EnumerableSet.AddressSet;
    using Strings for uint256;

    error InvalidParameter();
    error RendererExists();
    error UnknownRenderer();

    error TooLate();

    error InvalidDate();

    error NotAuthorized();

    struct Renderer {
        address creator; // the renderer creator
        uint32 royalties; // the renderer royalties
        uint32 remainingUse; // how many times this renderer can be used
    }

    struct TokenMeta {
        address renderer; // the renderer for this token;
        uint96 creation;
        bytes32 seed; // the seed for this token
    }

    mapping(address => Renderer) public renderers;

    mapping(uint256 => TokenMeta) public tokensMeta;

    EnumerableSet.AddressSet internal _availableRenderers;

    EnumerableSet.AddressSet internal _beneficiaries;

    uint256 beneficiaryIndex;

    // The ERC721 token contract
    address public nftContract;

    constructor(address weth_) NFBaseModule('') NiftyPrideAuctionHouse(weth_) {}

    ////////////////////////////////////////////////////
    ///// Module                                      //
    ////////////////////////////////////////////////////

    /// @inheritdoc	INFModule
    function onAttach() external virtual override returns (bool) {
        if (nftContract == address(0)) {
            nftContract = msg.sender;
            return true;
        }

        // only allows attachment if nftContract if not set
        return false;
    }

    function supportsInterface(bytes4 interfaceId)
        public
        view
        virtual
        override(ERC165, IERC165)
        returns (bool)
    {
        return
            interfaceId == type(INFModuleTokenURI).interfaceId ||
            interfaceId == type(INFModuleWithRoyalties).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    /// @inheritdoc	INFModuleWithRoyalties
    function royaltyInfo(address, uint256 tokenId)
        public
        view
        override
        returns (address, uint256)
    {
        TokenMeta memory tokenMeta = tokensMeta[tokenId];
        Renderer memory renderer = renderers[tokenMeta.renderer];

        return (renderer.creator, uint256(renderer.royalties));
    }

    /// @inheritdoc	INFModuleTokenURI
    function tokenURI(address, uint256 tokenId)
        public
        view
        override
        returns (string memory)
    {
        TokenMeta memory tokenMeta = tokensMeta[tokenId];

        (string memory imageURI, string memory animationURI) = IRenderer(
            tokenMeta.renderer
        ).render(tokenMeta.seed);

        return
            Base64.toB64JSON(
                abi.encodePacked(
                    '{"name":"Pride | ',
                    _getDate(tokenMeta.creation),
                    '","description":"',
                    IRenderer(tokenMeta.renderer).description(),
                    '","image":"',
                    imageURI,
                    '"',
                    (
                        bytes(animationURI).length > 0
                            ? abi.encodePacked(
                                ',"animation_url":"',
                                animationURI,
                                '"'
                            )
                            : bytes('')
                    ),
                    '}'
                )
            );
    }

    ////////////////////////////////////////////////////
    ///// Getters                                     //
    ////////////////////////////////////////////////////

    function getAvailableRenderers()
        external
        view
        returns (Renderer[] memory availableRenderers)
    {
        uint256 length = _availableRenderers.length();

        availableRenderers = new Renderer[](length);
        for (uint256 i; i < length; i++) {
            availableRenderers[i] = renderers[_availableRenderers.at(i)];
        }
    }

    ////////////////////////////////////////////////////
    ///// Setters                                     //
    ////////////////////////////////////////////////////

    /// @notice allows a renderer creator to change where the renderer points (for Royalties purpose mainly)
    /// @param renderer the renderer to edit
    /// @param creator the new creator address
    function setRendererCreator(address renderer, address creator) external {
        if (msg.sender != renderers[renderer].creator) {
            revert NotAuthorized();
        }

        renderers[renderer].creator = creator;
    }

    ////////////////////////////////////////////////////
    ///// Misc                                        //
    ////////////////////////////////////////////////////

    function onERC721Received(
        address operator,
        address,
        uint256,
        bytes memory
    ) public view returns (bytes4) {
        // if not our nftContract and not a mint
        if (msg.sender != nftContract || operator != address(this)) {
            revert NotAuthorized();
        }

        return this.onERC721Received.selector;
    }

    ////////////////////////////////////////////////////
    ///// Owner                                       //
    ////////////////////////////////////////////////////

    /// @notice allows owner to start the first auction which is a bit special.
    function startFirst() external onlyOwner {
        uint256 tokenId = _mintNext();

        if (tokenId != 1) revert TooLate();

        // forcing the first auction timestamp at June 1st 3PM UTC because I started this project late late on
        // June 1st 2022 and I am not sure I can deploy before June 2nd
        uint256 startTime = 1654095600;
        uint256 endTime = startTime + duration;

        tokensMeta[tokenId].creation = uint96(startTime);

        auction = Auction({
            tokenId: tokenId,
            amount: 0,
            startTime: startTime,
            endTime: endTime,
            bidder: payable(0),
            settled: false
        });

        emit AuctionCreated(tokenId, startTime, endTime);

        _unpause();
    }

    /// @notice allows owner to add a new renderer contract
    function addRenderer(
        address renderer,
        address creator,
        uint32 royalties,
        uint32 times
    ) public onlyOwner {
        if (times == 0) revert InvalidParameter();
        if (creator == address(0)) revert InvalidParameter();
        if (renderers[renderer].creator != address(0)) revert RendererExists();

        renderers[renderer] = Renderer(creator, royalties, times);
        _availableRenderers.add(renderer);
    }

    /// @notice allows owner to remove a contract from the available renderers
    function removeAvailableRenderer(address renderer) external onlyOwner {
        if (!_availableRenderers.remove(renderer)) revert UnknownRenderer();
    }

    /// @notice adds `beneficiary` to the list of beneficiaries
    /// @param beneficiary the new beneficiary
    function addBeneficiary(address beneficiary) public onlyOwner {
        if (beneficiary == address(0)) revert InvalidParameter();
        if (!_beneficiaries.add(beneficiary)) revert InvalidParameter();
    }

    /// @notice removes `beneficiary` from the list of beneficiaries
    /// @param beneficiary the beneficiary to remove
    function removeBeneficiary(address beneficiary) public onlyOwner {
        if (!_beneficiaries.remove(beneficiary)) revert InvalidParameter();
    }

    ////////////////////////////////////////////////////
    ///// Internals                                   //
    ////////////////////////////////////////////////////

    function _createAuction() internal override {
        (uint256 year, uint256 month, ) = _getYearMonthDay(block.timestamp);

        // only June 2022 for this contract.
        if (year != 2022 || month != 6) {
            revert InvalidDate();
        }

        super._createAuction();
    }

    /// @dev internal function to allow transfer to revenue recipient(s)
    function _transferToRecipients(uint256 tokenId, uint256 amount)
        internal
        virtual
        override
    {
        uint256 creatorShare = (amount * 10) / 100;
        // transfer 10% to the creator of the Renderer linked the the NFT
        _safeTransferETHWithFallback(
            renderers[tokensMeta[tokenId].renderer].creator,
            creatorShare
        );

        // transfer what's left to the next "beneficiary" in the list of all beneficiaries
        _safeTransferETHWithFallback(_nextBeneficiary(), amount - creatorShare);
    }

    function _mintNext() internal override returns (uint256) {
        uint256 tokenId = INiftyForge721(nftContract).mint(address(this));

        bytes32 seed = keccak256(
            abi.encodePacked(
                msg.sender,
                block.timestamp,
                block.difficulty,
                tokenId
            )
        );

        address renderer = _availableRenderers.at(
            uint256(seed) % _availableRenderers.length()
        );

        // decrement the remaining use for this renderer
        if (--renderers[renderer].remainingUse == 0) {
            // and remove this renderer from the list of available renderers if 0
            _availableRenderers.remove(renderer);
        }

        tokensMeta[tokenId] = TokenMeta({
            renderer: renderer,
            creation: uint96(block.timestamp),
            seed: seed
        });

        return tokenId;
    }

    function _getRegistry() internal view override returns (address) {
        return nftContract;
    }

    function _getDate(uint256 timestamp) internal view returns (string memory) {
        (uint256 year, uint256 month, uint256 day) = _getYearMonthDay(
            timestamp
        );
        return
            string(
                abi.encodePacked(
                    year.toString(),
                    '/',
                    month.toString(),
                    '/',
                    day.toString()
                )
            );
    }

    function _getYearMonthDay(uint256 timestamp)
        internal
        view
        returns (
            uint256 year,
            uint256 month,
            uint256 day
        )
    {
        address bokky;
        if (block.chainid == 1) {
            bokky = address(0x23d23d8F243e57d0b924bff3A3191078Af325101);
        } else if (block.chainid == 4) {
            bokky = address(0x047C6386C30E785F7a8fd536945410802a605395);
        }

        if (address(0) != bokky) {
            (year, month, day, , , ) = IBokkyPooBahsDateTimeContract(bokky)
                .timestampToDateTime(timestamp);
        } else {
            // force 2022-06 for chainid not 1 or 4
            year = 2022;
            month = 6;
        }
    }

    function _nextBeneficiary() internal returns (address) {
        uint256 length = _beneficiaries.length();
        uint256 beneficiaryIndex_ = beneficiaryIndex;
        address beneficiary = _beneficiaries.at(beneficiaryIndex_ % length);
        beneficiaryIndex = (beneficiaryIndex_ + 1) % length;
        return beneficiary;
    }
}

File 2 of 34 : INiftyForge721.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import './NFT/IERC721Full.sol';

/// @title INiftyForge721
/// @author Simon Fremaux (@dievardump)
/// @notice Interface to interact with a NiftyFroge721 on a network
interface INiftyForge721 is IERC721Full {
    struct ModuleInit {
        address module;
        bool enabled;
        bool minter;
    }

    /// @notice this is the constructor of the contract, called at the time of creation
    ///         Although it uses what are called upgradeable contracts, this is only to
    ///         be able to make deployment cheap using a Proxy but NiftyForge contracts
    ///         ARE NOT UPGRADEABLE => the proxy used is not an upgradeable proxy, the implementation is immutable
    /// @param name_ name of the contract (see ERC721)
    /// @param symbol_ symbol of the contract (see ERC721)
    /// @param contractURI_ The contract URI (containing its metadata) - can be empty ""
    /// @param baseURI_ the contract baseURI (if there is)  - can be empty ""
    /// @param owner_ Address to whom transfer ownership
    /// @param modulesInit_ modules to add / enable directly at creation
    /// @param contractRoyaltiesRecipient the recipient, if the contract has "contract wide royalties"
    /// @param contractRoyaltiesValue the value, modules to add / enable directly at creation
    function initialize(
        string memory name_,
        string memory symbol_,
        string memory contractURI_,
        string memory baseURI_,
        address owner_,
        ModuleInit[] memory modulesInit_,
        address contractRoyaltiesRecipient,
        uint256 contractRoyaltiesValue
    ) external;

    /// @notice getter for the version of the implementation
    /// @return the current implementation version following the scheme 0x[erc][type][version]
    /// erc: 00 => ERC721 | 01 => ERC1155
    /// type: 00 => full | 01 => slim
    /// version: 00, 01, 02, 03...
    function version() external view returns (bytes3);

    /// @notice totalSupply access
    function totalSupply() external view returns (uint256);

    /// @notice helper to know if everyone can mint or only minters
    function isMintingOpenToAll() external view returns (bool);

    /// @notice Toggle minting open to all state
    /// @param isOpen if the new state is open or not
    function setMintingOpenToAll(bool isOpen) external;

    /// @notice Allows to set a maximum number of mint possible
    function setMaxSupply(uint256 maxSupply_) external;

    /// @notice Mint next token to `to`
    /// @param to address of recipient
    /// @return tokenId the tokenId
    function mint(address to) external returns (uint256 tokenId);

    /// @notice Mint next token to `to` and then transfers to `transferTo`
    /// @param to address of first recipient
    /// @param transferTo address to transfer token to
    /// @return tokenId the tokenId
    function mint(address to, address transferTo)
        external
        returns (uint256 tokenId);

    /// @notice Mint token to `to` with `uri`
    /// @param to address of recipient
    /// @param uri token metadata uri
    /// @param feeRecipient the recipient of royalties
    /// @param feeAmount the royalties amount. From 0 to 10000
    ///        where 10000 == 100.00%; 1000 == 10.00%; 250 == 2.50%
    /// @param transferTo the address to transfer the NFT to after mint
    ///        this is used when we want to mint the NFT to the creator address
    ///        before transferring it to a recipient
    /// @return tokenId the tokenId
    function mint(
        address to,
        string memory uri,
        address feeRecipient,
        uint256 feeAmount,
        address transferTo
    ) external returns (uint256 tokenId);

    /// @notice Mint batch tokens to `to[i]` with `uri[i]`
    /// @param to array of address of recipients
    /// @param uris array of token metadata uris
    /// @param feeRecipients the recipients of royalties for each id
    /// @param feeAmounts the royalties amounts for each id. From 0 to 10000
    ///        where 10000 == 100.00%; 1000 == 10.00%; 250 == 2.50%
    /// @return startId the first id
    /// @return endId the last id
    function mintBatch(
        address[] memory to,
        string[] memory uris,
        address[] memory feeRecipients,
        uint256[] memory feeAmounts
    ) external returns (uint256 startId, uint256 endId);

    /// @notice Mint `tokenId` to to` with `uri`
    ///         Because not all tokenIds have incremental ids
    ///         be careful with this function, it does not increment lastTokenId
    ///         and expects the minter to actually know what it is doing.
    ///         this also means, this function does not verify _maxTokenId
    /// @param to address of recipient
    /// @param uri token metadata uri
    /// @param tokenId token id wanted
    /// @param feeRecipient the recipient of royalties
    /// @param feeAmount the royalties amount. From 0 to 10000
    ///        where 10000 == 100.00%; 1000 == 10.00%; 250 == 2.50%
    /// @param transferTo the address to transfer the NFT to after mint
    ///        this is used when we want to mint the NFT to the creator address
    ///        before transferring it to a recipient
    /// @return tokenId the tokenId
    function mint(
        address to,
        string memory uri,
        uint256 tokenId_,
        address feeRecipient,
        uint256 feeAmount,
        address transferTo
    ) external returns (uint256 tokenId);

    /// @notice Mint batch tokens to `to[i]` with `uris[i]`
    ///         Because not all tokenIds have incremental ids
    ///         be careful with this function, it does not increment lastTokenId
    ///         and expects the minter to actually know what it's doing.
    ///         this also means, this function does not verify _maxTokenId
    /// @param to array of address of recipients
    /// @param uris array of token metadata uris
    /// @param tokenIds array of token ids wanted
    /// @param feeRecipients the recipients of royalties for each id
    /// @param feeAmounts the royalties amounts for each id. From 0 to 10000
    ///        where 10000 == 100.00%; 1000 == 10.00%; 250 == 2.50%
    function mintBatch(
        address[] memory to,
        string[] memory uris,
        uint256[] memory tokenIds,
        address[] memory feeRecipients,
        uint256[] memory feeAmounts
    ) external;

    /// @notice Attach a module
    /// @param module a module to attach
    /// @param enabled if the module is enabled by default
    /// @param canModuleMint if the module has to be given the minter role
    function attachModule(
        address module,
        bool enabled,
        bool canModuleMint
    ) external;

    /// @dev Allows owner to enable a module
    /// @param module to enable
    /// @param canModuleMint if the module has to be given the minter role
    function enableModule(address module, bool canModuleMint) external;

    /// @dev Allows owner to disable a module
    /// @param module to disable
    function disableModule(address module, bool keepListeners) external;

    /// @notice allows to force the collection to start ids at 0
    function startAtZero() external;

    /// @notice function that returns a string that can be used to render the current token
    /// @param tokenId tokenId
    /// @return the URI to render token
    function renderTokenURI(uint256 tokenId)
        external
        view
        returns (string memory);
}

File 3 of 34 : INFModule.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import '@openzeppelin/contracts/utils/introspection/IERC165.sol';

interface INFModule is IERC165 {
    /// @notice Called by a Token Registry whenever the module is Attached
    /// @return if the attach worked
    function onAttach() external returns (bool);

    /// @notice Called by a Token Registry whenever the module is Enabled
    /// @return if the enabling worked
    function onEnable() external returns (bool);

    /// @notice Called by a Token Registry whenever the module is Disabled
    function onDisable() external;

    /// @notice returns an URI with information about the module
    /// @return the URI where to find information about the module
    function contractURI() external view returns (string memory);
}

File 4 of 34 : INFModuleTokenURI.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

interface INFModuleTokenURI {
    function tokenURI(address registry, uint256 tokenId)
        external
        view
        returns (string memory);
}

File 5 of 34 : INFModuleWithRoyalties.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

interface INFModuleWithRoyalties {
    /// @notice Return royalties (recipient, basisPoint) for tokenId
    /// @dev Contrary to EIP2981, modules are expected to return basisPoint for second parameters
    ///      This in order to allow right royalties on marketplaces not supporting 2981 (like Rarible)
    /// @param registry registry to check id of
    /// @param tokenId token to check
    /// @return recipient and basisPoint for this tokenId
    function royaltyInfo(address registry, uint256 tokenId)
        external
        view
        returns (address recipient, uint256 basisPoint);
}

File 6 of 34 : NFBaseModule.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';
import '@openzeppelin/contracts/utils/introspection/ERC165.sol';
import './INFModule.sol';

/// @title NFBaseModule
/// @author Simon Fremaux (@dievardump)
contract NFBaseModule is INFModule, ERC165 {
    using EnumerableSet for EnumerableSet.AddressSet;

    EnumerableSet.AddressSet internal _attached;

    event NewContractURI(string contractURI);

    string private _contractURI;

    modifier onlyAttached(address registry) {
        require(_attached.contains(registry), '!NOT_ATTACHED!');
        _;
    }

    constructor(string memory contractURI_) {
        _setContractURI(contractURI_);
    }

    /// @inheritdoc	INFModule
    function contractURI()
        external
        view
        virtual
        override
        returns (string memory)
    {
        return _contractURI;
    }

    /// @inheritdoc	INFModule
    function onAttach() external virtual override returns (bool) {
        if (_attached.add(msg.sender)) {
            return true;
        }

        revert('!ALREADY_ATTACHED!');
    }

    /// @notice this contract doesn't really care if it's enabled or not
    ///         since trying to mint on a contract where it's not enabled will fail
    /// @inheritdoc	INFModule
    function onEnable() external virtual override returns (bool) {
        return true;
    }

    /// @inheritdoc	INFModule
    function onDisable() external virtual override {}

    function _setContractURI(string memory contractURI_) internal {
        _contractURI = contractURI_;
        emit NewContractURI(contractURI_);
    }
}

File 7 of 34 : IERC721WithMutableURI.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

/// @dev This is the interface for NFT extension mutableURI
/// @author Simon Fremaux (@dievardump)
interface IERC721WithMutableURI {
    function mutableURI(uint256 tokenId) external view returns (string memory);
}

File 8 of 34 : IERC721WithRoyalties.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import '../Royalties/ERC2981/IERC2981Royalties.sol';
import '../Royalties/RaribleSecondarySales/IRaribleSecondarySales.sol';
import '../Royalties/FoundationSecondarySales/IFoundationSecondarySales.sol';

/// @dev This is a contract used for royalties on various platforms
/// @author Simon Fremaux (@dievardump)
interface IERC721WithRoyalties is
    IERC2981Royalties,
    IRaribleSecondarySales,
    IFoundationSecondarySales
{

}

File 9 of 34 : IERC721Full.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import '@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol';

import './ERC721/IERC721WithRoyalties.sol';
import './ERC721/IERC721WithMutableURI.sol';

/// @title ERC721Full
/// @dev This contains all the different overrides needed on
///      ERC721 / URIStorage / Royalties
///      This contract does not use ERC721enumerable because Enumerable adds quite some
///      gas to minting costs and I am trying to make this cheap for creators.
///      Also, since all NiftyForge contracts will be fully indexed in TheGraph it will easily
///      Be possible to get tokenIds of an owner off-chain, before passing them to a contract
///      which can verify ownership at the processing time
/// @author Simon Fremaux (@dievardump)
interface IERC721Full is
    IERC721Upgradeable,
    IERC721WithRoyalties,
    IERC721WithMutableURI
{
    function baseURI() external view returns (string memory);

    function contractURI() external view returns (string memory);

    /// @notice This is a generic function that allows this contract's owner to withdraw
    ///         any balance / ERC20 / ERC721 / ERC1155 it can have
    ///         this contract has no payable nor receive function so it should not get any nativ token
    ///         but this could save some ERC20, 721 or 1155
    /// @param token the token to withdraw from. address(0) means native chain token
    /// @param amount the amount to withdraw if native token, erc20 or erc1155 - must be 0 for ERC721
    /// @param tokenId the tokenId to withdraw for ERC1155 and ERC721
    function withdraw(
        address token,
        uint256 amount,
        uint256 tokenId
    ) external;

    /// @notice Helper to know if an address can do the action an Editor can
    /// @param account the address to check
    function canEdit(address account) external view returns (bool);

    /// @notice Helper to know if an address can do the action a Minter can
    /// @param account the address to check
    function canMint(address account) external view returns (bool);

    /// @notice Helper to know if an address is editor
    /// @param account the address to check
    function isEditor(address account) external view returns (bool);

    /// @notice Helper to know if an address is minter
    /// @param account the address to check
    function isMinter(address account) external view returns (bool);

    /// @notice Allows to get approved using a permit and transfer in the same call
    /// @dev this supposes that the permit is for msg.sender
    /// @param from current owner
    /// @param to recipient
    /// @param tokenId the token id
    /// @param _data optional data to add
    /// @param deadline the deadline for the permit to be used
    /// @param signature of permit
    function safeTransferFromWithPermit(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data,
        uint256 deadline,
        bytes memory signature
    ) external;

    /// @notice Set the base token URI
    /// @dev only an editor can do that (account or module)
    /// @param baseURI_ the new base token uri used in tokenURI()
    function setBaseURI(string memory baseURI_) external;

    /// @notice Set the base mutable meta URI for tokens
    /// @param baseMutableURI_ the new base for mutable meta uri used in mutableURI()
    function setBaseMutableURI(string memory baseMutableURI_) external;

    /// @notice Set the mutable URI for a token
    /// @dev    Mutable URI work like tokenURI
    ///         -> if there is a baseMutableURI and a mutableURI, concat baseMutableURI + mutableURI
    ///         -> else if there is only mutableURI, return mutableURI
    //.         -> else if there is only baseMutableURI, concat baseMutableURI + tokenId
    /// @dev only an editor (account or module) can call this
    /// @param tokenId the token to set the mutable URI for
    /// @param mutableURI_ the mutable URI
    function setMutableURI(uint256 tokenId, string memory mutableURI_) external;

    /// @notice Helper for the owner to add new editors
    /// @dev needs to be owner
    /// @param users list of new editors
    function addEditors(address[] memory users) external;

    /// @notice Helper for the owner to remove editors
    /// @dev needs to be owner
    /// @param users list of removed editors
    function removeEditors(address[] memory users) external;

    /// @notice Helper for an editor to add new minter
    /// @dev needs to be owner
    /// @param users list of new minters
    function addMinters(address[] memory users) external;

    /// @notice Helper for an editor to remove minters
    /// @dev needs to be owner
    /// @param users list of removed minters
    function removeMinters(address[] memory users) external;

    /// @notice Allows to change the default royalties recipient
    /// @dev an editor can call this
    /// @param recipient new default royalties recipient
    function setDefaultRoyaltiesRecipient(address recipient) external;

    /// @notice Allows a royalty recipient of a token to change their recipient address
    /// @dev only the current token royalty recipient can change the address
    /// @param tokenId the token to change the recipient for
    /// @param recipient new default royalties recipient
    function setTokenRoyaltiesRecipient(uint256 tokenId, address recipient)
        external;

    /// @notice Helper for the owner of the contract to set the new contract URI
    /// @dev needs to be owner
    /// @param contractURI_ new contract URI
    function setContractURI(string memory contractURI_) external;
}

File 10 of 34 : IERC2981Royalties.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

/// @title IERC2981Royalties
/// @dev Interface for the ERC2981 - Token Royalty standard
interface IERC2981Royalties {
    /// @notice Called with the sale price to determine how much royalty
    //          is owed and to whom.
    /// @param _tokenId - the NFT asset queried for royalty information
    /// @param _value - the sale price of the NFT asset specified by _tokenId
    /// @return _receiver - address of who should be sent the royalty payment
    /// @return _royaltyAmount - the royalty payment amount for value sale price
    function royaltyInfo(uint256 _tokenId, uint256 _value)
        external
        view
        returns (address _receiver, uint256 _royaltyAmount);
}

File 11 of 34 : IFoundationSecondarySales.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

interface IFoundationSecondarySales {
    /// @notice returns a list of royalties recipients and the amount
    /// @param tokenId the token Id to check for
    /// @return all the recipients and their basis points, for tokenId
    function getFees(uint256 tokenId)
        external
        view
        returns (address payable[] memory, uint256[] memory);
}

File 12 of 34 : IRaribleSecondarySales.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

interface IRaribleSecondarySales {
    /// @notice returns a list of royalties recipients
    /// @param tokenId the token Id to check for
    /// @return all the recipients for tokenId
    function getFeeRecipients(uint256 tokenId)
        external
        view
        returns (address payable[] memory);

    /// @notice returns a list of royalties amounts
    /// @param tokenId the token Id to check for
    /// @return all the amounts for tokenId
    function getFeeBps(uint256 tokenId)
        external
        view
        returns (uint256[] memory);
}

File 13 of 34 : IERC721Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165Upgradeable.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721Upgradeable is IERC165Upgradeable {
    /**
     * @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;
}

File 14 of 34 : IERC165Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165Upgradeable {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 15 of 34 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 16 of 34 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!paused(), "Pausable: paused");
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(paused(), "Pausable: not paused");
        _;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

File 17 of 34 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

File 18 of 34 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)

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);
}

File 19 of 34 : ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to owner address
    mapping(uint256 => address) private _owners;

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

    // Mapping from token ID to approved address
    mapping(uint256 => address) private _tokenApprovals;

    // Mapping from owner to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return
            interfaceId == type(IERC721).interfaceId ||
            interfaceId == type(IERC721Metadata).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: 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 {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: 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 Approve `operator` to operate on all of `owner` tokens
     *
     * Emits a {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev 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 {}
}

File 20 of 34 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, 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;
}

File 21 of 34 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 22 of 34 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

File 23 of 34 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

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);
            }
        }
    }
}

File 24 of 34 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

File 25 of 34 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

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);
    }
}

File 26 of 34 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 27 of 34 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 28 of 34 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol)

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastvalue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastvalue;
                // Update the index for the moved value
                set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        return _values(set._inner);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        assembly {
            result := store
        }

        return result;
    }
}

File 29 of 34 : NiftyPrideAuctionHouse.sol
// SPDX-License-Identifier: GPL-3.0

/// @title The NiftyPride Auction House

/************************************
 * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *
 * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *
 * ░░████░░████░░██░░████░░░░████░░ *
 * ░░█░░█░░█░░█░░██░░█░░░█░░░█░░░░░ *
 * ░░████░░███░░░██░░█░░░░█░░███░░░ *
 * ░░█░░░░░█░█░░░██░░█░░░█░░░█░░░░░ *
 * ░░█░░░░░█░░█░░██░░████░░░░████░░ *
 * ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ *
 ***********************************/

// LICENSE
// NiftyPrideAuctionHouse.sol is a modified version of Noun's NounsAuctionHouse.sol:
// https://github.com/nounsDAO/nouns-monorepo/blob/17e61ecaf6f1c66ca8035bf4e0c3c8dae58ca937/packages/nouns-contracts/contracts/NounsAuctionHouse.sol
//
// and is published under the same GPL-3.0 license

pragma solidity ^0.8.6;

import {Pausable} from '@openzeppelin/contracts/security/Pausable.sol';
import {ReentrancyGuard} from '@openzeppelin/contracts/security/ReentrancyGuard.sol';
import {Ownable} from '@openzeppelin/contracts/access/Ownable.sol';
import {IERC20} from '@openzeppelin/contracts/token/ERC20/IERC20.sol';
import {ERC721} from '@openzeppelin/contracts/token/ERC721/ERC721.sol';

import {IAuctionHouse} from './interfaces/IAuctionHouse.sol';
import {IWETH} from './interfaces/IWETH.sol';

contract NiftyPrideAuctionHouse is
    IAuctionHouse,
    Pausable,
    ReentrancyGuard,
    Ownable
{
    error WrongAuction();
    error AuctionExpired();
    error ReservePriceNotMet();
    error BidTooLow();

    error AuctionNotStarted();
    error AuctionAlreadySettled();
    error AuctionNotEnded();

    error RegistryNotSet();

    /// @notice The address of the WETH contract
    address public weth;

    /// @notice The minimum amount of time left in an auction after a new bid is created
    uint256 public timeBuffer = 10 minutes;

    /// @notice The minimum price accepted in an auction
    uint256 public reservePrice = 0.01 ether;

    /// @notice The minimum percentage difference between the last bid amount and the current bid
    uint8 public minBidIncrementPercentage = 5;

    /// @notice The duration of a single auction
    uint256 public duration = 24 hours;

    /// @notice The active auction
    IAuctionHouse.Auction public auction;

    constructor(address weth_) {
        _pause();

        if (block.chainid == 1) {
            weth = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
        } else if (block.chainid == 4) {
            weth = 0xc778417E063141139Fce010982780140Aa0cD5Ab;
        } else {
            weth = weth_;
        }
    }

    ////////////////////////////////////////////////////
    ///// Public                                      //
    ////////////////////////////////////////////////////

    /**
     * @notice Settle the current auction, mint a new token, and put it up for auction.
     */
    function settleCurrentAndCreateNewAuction()
        external
        override
        nonReentrant
        whenNotPaused
    {
        _settleAuction();
        _createAuction();
    }

    /**
     * @notice Settle the current auction.
     * @dev This function can only be called when the contract is paused.
     */
    function settleAuction() external override whenPaused nonReentrant {
        _settleAuction();
    }

    /**
     * @notice Create a bid for a token, with a given amount.
     * @dev This contract only accepts payment in ETH.
     */
    function createBid(uint256 tokenId) external payable override nonReentrant {
        IAuctionHouse.Auction memory _auction = auction;

        if (_auction.tokenId != tokenId) revert WrongAuction();
        if (block.timestamp >= _auction.endTime) revert AuctionExpired();
        if (msg.value < reservePrice) revert ReservePriceNotMet();

        if (
            msg.value <
            _auction.amount +
                ((_auction.amount * minBidIncrementPercentage) / 100)
        ) {
            revert BidTooLow();
        }

        address payable lastBidder = _auction.bidder;

        // Refund the last bidder, if applicable
        if (lastBidder != address(0)) {
            _safeTransferETHWithFallback(lastBidder, _auction.amount);
        }

        auction.amount = msg.value;
        auction.bidder = payable(msg.sender);

        // Extend the auction if the bid was received within `timeBuffer` of the auction end time
        bool extended = _auction.endTime - block.timestamp < timeBuffer;
        if (extended) {
            auction.endTime = _auction.endTime = block.timestamp + timeBuffer;
        }

        emit AuctionBid(_auction.tokenId, msg.sender, msg.value, extended);

        if (extended) {
            emit AuctionExtended(_auction.tokenId, _auction.endTime);
        }
    }

    ////////////////////////////////////////////////////
    ///// Contract owner                              //
    ////////////////////////////////////////////////////

    /**
     * @notice Pause the auction house.
     * @dev This function can only be called by the owner when the
     * contract is unpaused. While no new auctions can be started when paused,
     * anyone can settle an ongoing auction.
     */
    function pause() external override onlyOwner {
        _pause();
    }

    /**
     * @notice Unpause the auction house.
     * @dev This function can only be called by the owner when the
     * contract is paused. If required, this function will start a new auction.
     */
    function unpause() external override onlyOwner {
        _unpause();

        if (auction.startTime == 0 || auction.settled) {
            _createAuction();
        }
    }

    /**
     * @notice Set the auction time buffer.
     * @dev Only callable by the owner.
     */
    function setTimeBuffer(uint256 _timeBuffer) external override onlyOwner {
        timeBuffer = _timeBuffer;

        emit AuctionTimeBufferUpdated(_timeBuffer);
    }

    /**
     * @notice Set the auction reserve price.
     * @dev Only callable by the owner.
     */
    function setReservePrice(uint256 _reservePrice)
        external
        override
        onlyOwner
    {
        reservePrice = _reservePrice;

        emit AuctionReservePriceUpdated(_reservePrice);
    }

    /**
     * @notice Set the auction minimum bid increment percentage.
     * @dev Only callable by the owner.
     */
    function setMinBidIncrementPercentage(uint8 _minBidIncrementPercentage)
        external
        override
        onlyOwner
    {
        minBidIncrementPercentage = _minBidIncrementPercentage;

        emit AuctionMinBidIncrementPercentageUpdated(
            _minBidIncrementPercentage
        );
    }

    ////////////////////////////////////////////////////
    ///// Internals                             //
    ////////////////////////////////////////////////////

    /**
     * @notice Create an auction.
     * @dev Store the auction details in the `auction` state variable and emit an AuctionCreated event.
     * If the mint reverts, the minter was updated without pausing this contract first. To remedy this,
     * catch the revert and pause this contract.
     */
    function _createAuction() internal virtual {
        uint256 tokenId = _mintNext();

        if (tokenId > 0) {
            uint256 startTime = block.timestamp;
            uint256 endTime = startTime + duration;

            auction = Auction({
                tokenId: tokenId,
                amount: 0,
                startTime: startTime,
                endTime: endTime,
                bidder: payable(0),
                settled: false
            });

            emit AuctionCreated(tokenId, startTime, endTime);
        } else {
            _pause();
        }
    }

    /**
     * @notice Settle an auction, finalizing the bid and paying out to the owner.
     * @dev If there are no bids, the token is sent to the current contract owner (and after to its creator).
     */
    function _settleAuction() internal {
        IAuctionHouse.Auction memory _auction = auction;

        if (_auction.startTime == 0) revert AuctionNotStarted();
        if (_auction.settled) revert AuctionAlreadySettled();
        if (block.timestamp < _auction.endTime) revert AuctionNotEnded();

        auction.settled = true;

        ERC721(_getRegistry()).transferFrom(
            address(this),
            (
                _auction.bidder == address(0)
                    ? owner() // if no bidder, send to owner() so it can go back to creator
                    : _auction.bidder
            ),
            _auction.tokenId
        );

        if (_auction.amount > 0) {
            _transferToRecipients(_auction.tokenId, _auction.amount);
        }

        emit AuctionSettled(_auction.tokenId, _auction.bidder, _auction.amount);
    }

    /**
     * @notice Transfer ETH. If the ETH transfer fails, wrap the ETH and try send it as WETH.
     */
    function _safeTransferETHWithFallback(address to, uint256 amount) internal {
        if (!_safeTransferETH(to, amount)) {
            IWETH(weth).deposit{value: amount}();
            IERC20(weth).transfer(to, amount);
        }
    }

    /**
     * @notice Transfer ETH and return the success status.
     * @dev This function only forwards 30,000 gas to the callee.
     */
    function _safeTransferETH(address to, uint256 value)
        internal
        returns (bool)
    {
        (bool success, ) = to.call{value: value, gas: 30_000}(new bytes(0));
        return success;
    }

    /// @dev internal function to allow transfer to revenue recipient(s), default to owner()
    function _transferToRecipients(uint256, uint256 amount) internal virtual {
        _safeTransferETHWithFallback(owner(), amount);
    }

    /// @dev internal function to mint next token, must be overrode
    function _mintNext() internal virtual returns (uint256) {
        return 0;
    }

    /// @dev internal function to get nft contract holder, must be overrode
    function _getRegistry() internal virtual returns (address) {
        return address(0);
    }
}

File 30 of 34 : IRenderer.sol
pragma solidity ^0.8.0;

interface IRenderer {
    function description() external view returns (string memory);

    function render(bytes32 seed)
        external
        view
        returns (string memory, string memory);
}

File 31 of 34 : IAuctionHouse.sol
// SPDX-License-Identifier: GPL-3.0

/// @title Interface for Auction Houses

/// modified from INounAuctionHouse.sol

pragma solidity ^0.8.6;

interface IAuctionHouse {
    struct Auction {
        // ID for the token (ERC721 token ID)
        uint256 tokenId;
        // The current highest bid amount
        uint256 amount;
        // The time that the auction started
        uint256 startTime;
        // The time that the auction is scheduled to end
        uint256 endTime;
        // The address of the current highest bid
        address payable bidder;
        // Whether or not the auction has been settled
        bool settled;
    }

    event AuctionCreated(
        uint256 indexed tokenId,
        uint256 startTime,
        uint256 endTime
    );

    event AuctionBid(
        uint256 indexed tokenId,
        address sender,
        uint256 value,
        bool extended
    );

    event AuctionExtended(uint256 indexed tokenId, uint256 endTime);

    event AuctionSettled(
        uint256 indexed tokenId,
        address winner,
        uint256 amount
    );

    event AuctionTimeBufferUpdated(uint256 timeBuffer);

    event AuctionReservePriceUpdated(uint256 reservePrice);

    event AuctionMinBidIncrementPercentageUpdated(
        uint256 minBidIncrementPercentage
    );

    function settleAuction() external;

    function settleCurrentAndCreateNewAuction() external;

    function createBid(uint256 tokenId) external payable;

    function pause() external;

    function unpause() external;

    function setTimeBuffer(uint256 timeBuffer) external;

    function setReservePrice(uint256 reservePrice) external;

    function setMinBidIncrementPercentage(uint8 minBidIncrementPercentage)
        external;
}

File 32 of 34 : IBokkyPooBahsDateTimeContract.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.6;

interface IBokkyPooBahsDateTimeContract {
    function timestampToDateTime(uint256 timestamp)
        external
        pure
        returns (
            uint256 year,
            uint256 month,
            uint256 day,
            uint256 hour,
            uint256 minute,
            uint256 second
        );
}

File 33 of 34 : IWETH.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.6;

interface IWETH {
    function deposit() external payable;

    function withdraw(uint256 wad) external;

    function transfer(address to, uint256 value) external returns (bool);
}

File 34 of 34 : Base64.sol
pragma solidity ^0.8.0;

// SPDX-License-Identifier: MIT

/// @title Base64
/// @author Brecht Devos - <[email protected]>
/// @notice Provides a function for encoding some bytes in base64

/// modified to add some utility functions
library Base64 {
    string internal constant TABLE =
        'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';

    function encode(bytes memory data) internal pure returns (string memory) {
        if (data.length == 0) return '';

        // load the table into memory
        string memory table = TABLE;

        // multiply by 4/3 rounded up
        uint256 encodedLen = 4 * ((data.length + 2) / 3);

        // add some extra buffer at the end required for the writing
        string memory result = new string(encodedLen + 32);

        assembly {
            // set the actual output length
            mstore(result, encodedLen)

            // prepare the lookup table
            let tablePtr := add(table, 1)

            // input ptr
            let dataPtr := data
            let endPtr := add(dataPtr, mload(data))

            // result ptr, jump over length
            let resultPtr := add(result, 32)

            // run over the input, 3 bytes at a time
            for {

            } lt(dataPtr, endPtr) {

            } {
                dataPtr := add(dataPtr, 3)

                // read 3 bytes
                let input := mload(dataPtr)

                // write 4 characters
                mstore(
                    resultPtr,
                    shl(248, mload(add(tablePtr, and(shr(18, input), 0x3F))))
                )
                resultPtr := add(resultPtr, 1)
                mstore(
                    resultPtr,
                    shl(248, mload(add(tablePtr, and(shr(12, input), 0x3F))))
                )
                resultPtr := add(resultPtr, 1)
                mstore(
                    resultPtr,
                    shl(248, mload(add(tablePtr, and(shr(6, input), 0x3F))))
                )
                resultPtr := add(resultPtr, 1)
                mstore(
                    resultPtr,
                    shl(248, mload(add(tablePtr, and(input, 0x3F))))
                )
                resultPtr := add(resultPtr, 1)
            }

            // padding with '='
            switch mod(mload(data), 3)
            case 1 {
                mstore(sub(resultPtr, 2), shl(240, 0x3d3d))
            }
            case 2 {
                mstore(sub(resultPtr, 1), shl(248, 0x3d))
            }
        }

        return result;
    }

    function toB64JSON(bytes memory toEncode)
        internal
        pure
        returns (string memory)
    {
        return
            string(
                abi.encodePacked(
                    'data:application/json;base64,',
                    encode(toEncode)
                )
            );
    }

    function toB64JSON(string memory toEncode)
        internal
        pure
        returns (string memory)
    {
        return toB64JSON(bytes(toEncode));
    }

    function toB64SVG(bytes memory toEncode)
        internal
        pure
        returns (string memory)
    {
        return
            string(
                abi.encodePacked('data:image/svg+xml;base64,', encode(toEncode))
            );
    }

    function toB64SVG(string memory toEncode)
        internal
        pure
        returns (string memory)
    {
        return toB64SVG(bytes(toEncode));
    }
}

Settings
{
  "evmVersion": "london",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"weth_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AuctionAlreadySettled","type":"error"},{"inputs":[],"name":"AuctionExpired","type":"error"},{"inputs":[],"name":"AuctionNotEnded","type":"error"},{"inputs":[],"name":"AuctionNotStarted","type":"error"},{"inputs":[],"name":"BidTooLow","type":"error"},{"inputs":[],"name":"InvalidDate","type":"error"},{"inputs":[],"name":"InvalidParameter","type":"error"},{"inputs":[],"name":"NotAuthorized","type":"error"},{"inputs":[],"name":"RegistryNotSet","type":"error"},{"inputs":[],"name":"RendererExists","type":"error"},{"inputs":[],"name":"ReservePriceNotMet","type":"error"},{"inputs":[],"name":"TooLate","type":"error"},{"inputs":[],"name":"UnknownRenderer","type":"error"},{"inputs":[],"name":"WrongAuction","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"bool","name":"extended","type":"bool"}],"name":"AuctionBid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endTime","type":"uint256"}],"name":"AuctionCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endTime","type":"uint256"}],"name":"AuctionExtended","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"minBidIncrementPercentage","type":"uint256"}],"name":"AuctionMinBidIncrementPercentageUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"reservePrice","type":"uint256"}],"name":"AuctionReservePriceUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"winner","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"AuctionSettled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"timeBuffer","type":"uint256"}],"name":"AuctionTimeBufferUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"contractURI","type":"string"}],"name":"NewContractURI","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"address","name":"beneficiary","type":"address"}],"name":"addBeneficiary","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"renderer","type":"address"},{"internalType":"address","name":"creator","type":"address"},{"internalType":"uint32","name":"royalties","type":"uint32"},{"internalType":"uint32","name":"times","type":"uint32"}],"name":"addRenderer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"auction","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"address payable","name":"bidder","type":"address"},{"internalType":"bool","name":"settled","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"createBid","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"duration","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAvailableRenderers","outputs":[{"components":[{"internalType":"address","name":"creator","type":"address"},{"internalType":"uint32","name":"royalties","type":"uint32"},{"internalType":"uint32","name":"remainingUse","type":"uint32"}],"internalType":"struct PrideModule.Renderer[]","name":"availableRenderers","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minBidIncrementPercentage","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nftContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"onAttach","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"onDisable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"onEnable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"renderer","type":"address"}],"name":"removeAvailableRenderer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"beneficiary","type":"address"}],"name":"removeBeneficiary","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"renderers","outputs":[{"internalType":"address","name":"creator","type":"address"},{"internalType":"uint32","name":"royalties","type":"uint32"},{"internalType":"uint32","name":"remainingUse","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"reservePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"_minBidIncrementPercentage","type":"uint8"}],"name":"setMinBidIncrementPercentage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"renderer","type":"address"},{"internalType":"address","name":"creator","type":"address"}],"name":"setRendererCreator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_reservePrice","type":"uint256"}],"name":"setReservePrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_timeBuffer","type":"uint256"}],"name":"setTimeBuffer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"settleAuction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"settleCurrentAndCreateNewAuction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startFirst","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"timeBuffer","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokensMeta","outputs":[{"internalType":"address","name":"renderer","type":"address"},{"internalType":"uint96","name":"creation","type":"uint96"},{"internalType":"bytes32","name":"seed","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"weth","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

6080604052610258600755662386f26fc100006008556009805460ff1916600517905562015180600a553480156200003657600080fd5b506040516200302438038062003024833981016040819052620000599162000312565b604080516020810190915260008152819062000075816200012a565b506003805460ff19169055600160045562000090336200017c565b6200009a620001ce565b4660011415620000d057600680546001600160a01b03191673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc217905562000122565b46600414156200010657600680546001600160a01b03191673c778417e063141139fce010982780140aa0cd5ab17905562000122565b600680546001600160a01b0319166001600160a01b0383161790555b5050620003d9565b80516200013f9060029060208401906200026c565b507fdf1280b84eee5cd4ce59294c59ec7288bd49034d7f3d142f57ba9b47791563648160405162000171919062000344565b60405180910390a150565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60035460ff1615620002195760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b604482015260640160405180910390fd5b6003805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586200024f3390565b6040516001600160a01b03909116815260200160405180910390a1565b8280546200027a906200039c565b90600052602060002090601f0160209004810192826200029e5760008555620002e9565b82601f10620002b957805160ff1916838001178555620002e9565b82800160010185558215620002e9579182015b82811115620002e9578251825591602001919060010190620002cc565b50620002f7929150620002fb565b5090565b5b80821115620002f75760008155600101620002fc565b6000602082840312156200032557600080fd5b81516001600160a01b03811681146200033d57600080fd5b9392505050565b600060208083528351808285015260005b81811015620003735785810183015185820160400152820162000355565b8181111562000386576000604083870101525b50601f01601f1916929092016040019392505050565b600181811c90821680620003b157607f821691505b60208210811415620003d357634e487b7160e01b600052602260045260246000fd5b50919050565b612c3b80620003e96000396000f3fe60806040526004361061020f5760003560e01c80637d9f6db511610118578063d71d4d72116100a0578063e9dc63751161006f578063e9dc637514610790578063ec91f2a4146107b0578063ed1b3144146107c6578063f25efffc146107db578063f2fde38b146107f057600080fd5b8063d71d4d72146106c6578063d98d6544146106db578063db2e1eed14610758578063e8a3d4851461076e57600080fd5b8063aca3f2a0116100e7578063aca3f2a0146105cb578063b079ac9014610646578063b296024d1461065a578063ce9c7c0d14610686578063d56d229d146106a657600080fd5b80637d9f6db51461050f5780638456cb59146105835780638da5cb5b14610598578063a4d0a17e146105b657600080fd5b80634c85eb1f1161019b578063638a0d4d1161016a578063638a0d4d14610485578063659dd2b4146104a75780636cdcaad5146104ba5780637120334b146104da578063715018a6146104fa57600080fd5b80634c85eb1f1461041e5780635926651d1461042d57806359633a1c1461044d5780635c975abb1461046d57600080fd5b80632782d6c7116101e25780632782d6c7146102c857806336ebdb38146103915780633f4ba83a146103b15780633fc8cef3146103c6578063442b95f7146103fe57600080fd5b806301ffc9a7146102145780630fb5a6b414610249578063150b7a021461026d578063244a5085146102a6575b600080fd5b34801561022057600080fd5b5061023461022f36600461239e565b610810565b60405190151581526020015b60405180910390f35b34801561025557600080fd5b5061025f600a5481565b604051908152602001610240565b34801561027957600080fd5b5061028d610288366004612453565b610862565b6040516001600160e01b03199091168152602001610240565b3480156102b257600080fd5b506102c66102c13660046124fe565b6108b7565b005b3480156102d457600080fd5b506103726102e3366004612519565b600090815260116020908152604080832081516060808201845282546001600160a01b03808216808552600160a01b928390046001600160601b031685890152600190950154938601939093529286526010855294839020835195860184525490811680865291810463ffffffff908116948601859052600160c01b9091041693909101929092529092909150565b604080516001600160a01b039093168352602083019190915201610240565b34801561039d57600080fd5b506102c66103ac366004612543565b610915565b3480156103bd57600080fd5b506102c6610988565b3480156103d257600080fd5b506006546103e6906001600160a01b031681565b6040516001600160a01b039091168152602001610240565b34801561040a57600080fd5b506102c661041936600461257a565b6109e1565b34801561042a57600080fd5b50005b34801561043957600080fd5b506102c66104483660046124fe565b610b20565b34801561045957600080fd5b506102c66104683660046124fe565b610b99565b34801561047957600080fd5b5060035460ff16610234565b34801561049157600080fd5b5061049a610bce565b60405161024091906125ce565b6102c66104b536600461263a565b610ce7565b3480156104c657600080fd5b506102c66104d5366004612653565b610f14565b3480156104e657600080fd5b506102c66104f536600461263a565b610f7c565b34801561050657600080fd5b506102c6610fdb565b34801561051b57600080fd5b50600b54600c54600d54600e54600f5461054b94939291906001600160a01b03811690600160a01b900460ff1686565b6040805196875260208701959095529385019290925260608401526001600160a01b03166080830152151560a082015260c001610240565b34801561058f57600080fd5b506102c661100f565b3480156105a457600080fd5b506005546001600160a01b03166103e6565b3480156105c257600080fd5b506102c6611041565b3480156105d757600080fd5b5061061a6105e63660046124fe565b6010602052600090815260409020546001600160a01b0381169063ffffffff600160a01b8204811691600160c01b90041683565b604080516001600160a01b03909416845263ffffffff9283166020850152911690820152606001610240565b34801561065257600080fd5b506001610234565b34801561066657600080fd5b506009546106749060ff1681565b60405160ff9091168152602001610240565b34801561069257600080fd5b506102c66106a136600461263a565b6110c1565b3480156106b257600080fd5b506017546103e6906001600160a01b031681565b3480156106d257600080fd5b506102c6611120565b3480156106e757600080fd5b5061072b6106f636600461263a565b601160205260009081526040902080546001909101546001600160a01b03821691600160a01b90046001600160601b03169083565b604080516001600160a01b0390941684526001600160601b03909216602084015290820152606001610240565b34801561076457600080fd5b5061025f60085481565b34801561077a57600080fd5b50610783611254565b60405161024091906126b6565b34801561079c57600080fd5b506107836107ab366004612519565b6112e6565b3480156107bc57600080fd5b5061025f60075481565b3480156107d257600080fd5b50610234611496565b3480156107e757600080fd5b506102c66114c7565b3480156107fc57600080fd5b506102c661080b3660046124fe565b611545565b60006001600160e01b0319821663e9dc637560e01b148061084157506001600160e01b03198216632782d6c760e01b145b8061085c57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6017546000906001600160a01b03163314158061088857506001600160a01b0385163014155b156108a65760405163ea8e4eb560e01b815260040160405180910390fd5b50630a85bd0160e11b949350505050565b6005546001600160a01b031633146108ea5760405162461bcd60e51b81526004016108e1906126e9565b60405180910390fd5b6108f56012826115dd565b610912576040516350dce02d60e11b815260040160405180910390fd5b50565b6005546001600160a01b0316331461093f5760405162461bcd60e51b81526004016108e1906126e9565b6009805460ff191660ff83169081179091556040519081527fec5ccd96cc77b6219e9d44143df916af68fc169339ea7de5008ff15eae13450d906020015b60405180910390a150565b6005546001600160a01b031633146109b25760405162461bcd60e51b81526004016108e1906126e9565b6109ba6115f9565b600d5415806109d25750600f54600160a01b900460ff165b156109df576109df61168c565b565b6005546001600160a01b03163314610a0b5760405162461bcd60e51b81526004016108e1906126e9565b63ffffffff8116610a2f57604051630309cb8760e51b815260040160405180910390fd5b6001600160a01b038316610a5657604051630309cb8760e51b815260040160405180910390fd5b6001600160a01b038481166000908152601060205260409020541615610a8f576040516320b10e2b60e11b815260040160405180910390fd5b604080516060810182526001600160a01b03808616825263ffffffff80861660208085019182528683168587019081528a85166000908152601090925295902093518454915195518316600160c01b0263ffffffff60c01b19968416600160a01b026001600160c01b031990931691909416171793909316179055610b199060129086906116d916565b5050505050565b6005546001600160a01b03163314610b4a5760405162461bcd60e51b81526004016108e1906126e9565b6001600160a01b038116610b7157604051630309cb8760e51b815260040160405180910390fd5b610b7c6014826116d9565b61091257604051630309cb8760e51b815260040160405180910390fd5b6005546001600160a01b03163314610bc35760405162461bcd60e51b81526004016108e1906126e9565b610b7c6014826115dd565b60606000610bdc60126116ee565b90508067ffffffffffffffff811115610bf757610bf76123e4565b604051908082528060200260200182016040528015610c4257816020015b6040805160608101825260008082526020808301829052928201528252600019909201910181610c155790505b50915060005b81811015610ce25760106000610c5f6012846116f8565b6001600160a01b039081168252602080830193909352604091820160002082516060810184529054918216815263ffffffff600160a01b8304811694820194909452600160c01b909104909216908201528351849083908110610cc457610cc461271e565b60200260200101819052508080610cda9061274a565b915050610c48565b505090565b60026004541415610d0a5760405162461bcd60e51b81526004016108e190612765565b60026004556040805160c081018252600b54808252600c546020830152600d5492820192909252600e546060820152600f546001600160a01b0381166080830152600160a01b900460ff16151560a0820152908214610d7c5760405163ca20fe1760e01b815260040160405180910390fd5b80606001514210610da057604051630129799f60e21b815260040160405180910390fd5b600854341015610dc3576040516379bb5b6160e01b815260040160405180910390fd5b6009546020820151606491610ddd9160ff9091169061279c565b610de791906127d1565b8160200151610df691906127e5565b341015610e1657604051635069375b60e11b815260040160405180910390fd5b60808101516001600160a01b03811615610e3857610e38818360200151611704565b34600c55600f80546001600160a01b03191633179055600754606083015160009190610e659042906127fd565b1090508015610e8657600754610e7b90426127e5565b60608401819052600e555b8251604080513381523460208201528315158183015290517f1159164c56f277e6fc99c11731bd380e0347deb969b75523398734c252706ea39181900360600190a28015610f0957825160608401516040519081527f6e912a3a9105bdd2af817ba5adc14e6c127c1035b5b648faa29ca0d58ab8ff4e9060200160405180910390a25b505060016004555050565b6001600160a01b03828116600090815260106020526040902054163314610f4e5760405163ea8e4eb560e01b815260040160405180910390fd5b6001600160a01b03918216600090815260106020526040902080546001600160a01b03191691909216179055565b6005546001600160a01b03163314610fa65760405162461bcd60e51b81526004016108e1906126e9565b60078190556040518181527f1b55d9f7002bda4490f467e326f22a4a847629c0f2d1ed421607d318d25b410d9060200161097d565b6005546001600160a01b031633146110055760405162461bcd60e51b81526004016108e1906126e9565b6109df60006117f3565b6005546001600160a01b031633146110395760405162461bcd60e51b81526004016108e1906126e9565b6109df611845565b60035460ff1661108a5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016108e1565b600260045414156110ad5760405162461bcd60e51b81526004016108e190612765565b60026004556110ba6118c0565b6001600455565b6005546001600160a01b031633146110eb5760405162461bcd60e51b81526004016108e1906126e9565b60088190556040518181527f6ab2e127d7fdf53b8f304e59d3aab5bfe97979f52a85479691a6fab27a28a6b29060200161097d565b6005546001600160a01b0316331461114a5760405162461bcd60e51b81526004016108e1906126e9565b6000611154611aaf565b9050806001146111775760405163ecdd1c2960e01b815260040160405180910390fd5b600a546362977ef09060009061118d90836127e5565b600084815260116020908152604080832080546001600160a01b0316600160a01b6001600160601b03891602179055805160c081018252878152808301849052808201879052606081018590526080810184905260a001839052600b879055600c92909255600d859055600e839055600f80546001600160a81b0319169055815185815290810183905291925084917fd6eddd1118d71820909c1197aa966dbc15ed6f508554252169cc3d5ccac756ca910160405180910390a261124f6115f9565b505050565b60606002805461126390612814565b80601f016020809104026020016040519081016040528092919081815260200182805461128f90612814565b80156112dc5780601f106112b1576101008083540402835291602001916112dc565b820191906000526020600020905b8154815290600101906020018083116112bf57829003601f168201915b5050505050905090565b600081815260116020908152604080832081516060808201845282546001600160a01b038116808452600160a01b9091046001600160601b03169583019590955260019092015481840181905292516316166e1560e31b8152600481019390935290939092909182919063b0b370a890602401600060405180830381865afa158015611376573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261139e9190810190612894565b9150915061148c6113bb84602001516001600160601b0316611c5e565b84600001516001600160a01b0316637284e4166040518163ffffffff1660e01b8152600401600060405180830381865afa1580156113fd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261142591908101906128f8565b8460008551116114445760405180602001604052806000815250611465565b84604051602001611455919061292d565b6040516020818303038152906040525b6040516020016114789493929190612973565b604051602081830303815290604052611cba565b9695505050505050565b6017546000906001600160a01b03166114c15750601780546001600160a01b03191633179055600190565b50600090565b600260045414156114ea5760405162461bcd60e51b81526004016108e190612765565b600260045560035460ff16156115355760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016108e1565b61153d6118c0565b6110ba61168c565b6005546001600160a01b0316331461156f5760405162461bcd60e51b81526004016108e1906126e9565b6001600160a01b0381166115d45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016108e1565b610912816117f3565b60006115f2836001600160a01b038416611ceb565b9392505050565b60035460ff166116425760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016108e1565b6003805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b60008061169842611dde565b5091509150816107e61415806116af575080600614155b156116cd576040516381bf7f6760e01b815260040160405180910390fd5b6116d5611ec3565b5050565b60006115f2836001600160a01b038416611f84565b600061085c825490565b60006115f28383611fd3565b61170e8282611ffd565b6116d557600660009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b15801561176257600080fd5b505af1158015611776573d6000803e3d6000fd5b505060065460405163a9059cbb60e01b81526001600160a01b03878116600483015260248201879052909116935063a9059cbb925060440190506020604051808303816000875af11580156117cf573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061124f9190612a3b565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60035460ff161561188b5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016108e1565b6003805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861166f3390565b6040805160c081018252600b548152600c546020820152600d54918101829052600e546060820152600f546001600160a01b0381166080830152600160a01b900460ff16151560a082015290611929576040516301dff5d560e71b815260040160405180910390fd5b8060a001511561194c57604051634f4fee1760e01b815260040160405180910390fd5b806060015142101561197157604051636463738960e01b815260040160405180910390fd5b600f805460ff60a01b1916600160a01b1790556119966017546001600160a01b031690565b6001600160a01b03166323b872dd3060006001600160a01b031684608001516001600160a01b0316146119cd5783608001516119da565b6005546001600160a01b03165b845160405160e085901b6001600160e01b03191681526001600160a01b0393841660048201529290911660248301526044820152606401600060405180830381600087803b158015611a2b57600080fd5b505af1158015611a3f573d6000803e3d6000fd5b50505050602081015115611a5f57611a5f8160000151826020015161207b565b80516080820151602080840151604080516001600160a01b039094168452918301527fc9f72b276a388619c6d185d146697036241880c36654b1a3ffdad07c24038d99910160405180910390a250565b6017546040516335313c2160e11b815230600482015260009182916001600160a01b0390911690636a627842906024016020604051808303816000875af1158015611afe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b229190612a5d565b6040516bffffffffffffffffffffffff193360601b166020820152426034820152446054820152607481018290529091506000906094016040516020818303038152906040528051906020012090506000611b92611b8060126116ee565b611b8a9084612a76565b6012906116f8565b6001600160a01b0381166000908152601060205260409020805491925090601890611bc990600160c01b900463ffffffff16612a8a565b91906101000a81548163ffffffff021916908363ffffffff160217905563ffffffff1660001415611c0157611bff6012826115dd565b505b604080516060810182526001600160a01b0392831681526001600160601b03428116602080840191825283850196875260008881526011909152939093209151925116600160a01b02919092161781559051600190910155919050565b60606000806000611c6e85611dde565b925092509250611c7d836120e4565b611c86836120e4565b611c8f836120e4565b604051602001611ca193929190612aaa565b6040516020818303038152906040529350505050919050565b6060611cc5826121ea565b604051602001611cd59190612b04565b6040516020818303038152906040529050919050565b60008181526001830160205260408120548015611dd4576000611d0f6001836127fd565b8554909150600090611d23906001906127fd565b9050818114611d88576000866000018281548110611d4357611d4361271e565b9060005260206000200154905080876000018481548110611d6657611d6661271e565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611d9957611d99612b49565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061085c565b600091505061085c565b6000806000804660011415611e0857507323d23d8f243e57d0b924bff3a3191078af325101611e28565b4660041415611e28575073047c6386c30e785f7a8fd536945410802a6053955b6001600160a01b03811615611eb157604051630ea1c16960e41b8152600481018690526001600160a01b0382169063ea1c16909060240160c060405180830381865afa158015611e7c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ea09190612b5f565b509397509195509350611ebb915050565b6107e69350600692505b509193909250565b6000611ecd611aaf565b90508015611f7c57600a544290600090611ee790836127e5565b6040805160c08101825285815260006020808301829052828401879052606083018590526080830182905260a0909201819052600b879055600c55600d859055600e839055600f80546001600160a81b0319169055815185815290810183905291925084917fd6eddd1118d71820909c1197aa966dbc15ed6f508554252169cc3d5ccac756ca910160405180910390a2505050565b610912611845565b6000818152600183016020526040812054611fcb5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561085c565b50600061085c565b6000826000018281548110611fea57611fea61271e565b9060005260206000200154905092915050565b6040805160008082526020820190925281906001600160a01b0385169061753090859060405161202d9190612ba9565b600060405180830381858888f193505050503d806000811461206b576040519150601f19603f3d011682016040523d82523d6000602084013e612070565b606091505b509095945050505050565b6000606461208a83600a61279c565b61209491906127d1565b6000848152601160209081526040808320546001600160a01b0390811684526010909252909120549192506120ca911682611704565b61124f6120d5612352565b6120df83856127fd565b611704565b6060816121085750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612132578061211c8161274a565b915061212b9050600a836127d1565b915061210c565b60008167ffffffffffffffff81111561214d5761214d6123e4565b6040519080825280601f01601f191660200182016040528015612177576020820181803683370190505b5090505b84156121e25761218c6001836127fd565b9150612199600a86612a76565b6121a49060306127e5565b60f81b8183815181106121b9576121b961271e565b60200101906001600160f81b031916908160001a9053506121db600a866127d1565b945061217b565b949350505050565b606081516000141561220a57505060408051602081019091526000815290565b6000604051806060016040528060408152602001612bc6604091399050600060038451600261223991906127e5565b61224391906127d1565b61224e90600461279c565b9050600061225d8260206127e5565b67ffffffffffffffff811115612275576122756123e4565b6040519080825280601f01601f19166020018201604052801561229f576020820181803683370190505b509050818152600183018586518101602084015b8183101561230d5760039283018051603f601282901c811687015160f890811b8552600c83901c8216880151811b6001860152600683901c8216880151811b60028601529116860151901b938201939093526004016122b3565b600389510660018114612327576002811461233857612344565b613d3d60f01b600119830152612344565b603d60f81b6000198301525b509398975050505050505050565b60008061235f60146116ee565b601654909150600061237c6123748484612a76565b6014906116f8565b90508261238a8360016127e5565b6123949190612a76565b6016559392505050565b6000602082840312156123b057600080fd5b81356001600160e01b0319811681146115f257600080fd5b80356001600160a01b03811681146123df57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715612423576124236123e4565b604052919050565b600067ffffffffffffffff821115612445576124456123e4565b50601f01601f191660200190565b6000806000806080858703121561246957600080fd5b612472856123c8565b9350612480602086016123c8565b925060408501359150606085013567ffffffffffffffff8111156124a357600080fd5b8501601f810187136124b457600080fd5b80356124c76124c28261242b565b6123fa565b8181528860208385010111156124dc57600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b60006020828403121561251057600080fd5b6115f2826123c8565b6000806040838503121561252c57600080fd5b612535836123c8565b946020939093013593505050565b60006020828403121561255557600080fd5b813560ff811681146115f257600080fd5b803563ffffffff811681146123df57600080fd5b6000806000806080858703121561259057600080fd5b612599856123c8565b93506125a7602086016123c8565b92506125b560408601612566565b91506125c360608601612566565b905092959194509250565b602080825282518282018190526000919060409081850190868401855b8281101561262d57815180516001600160a01b031685528681015163ffffffff90811688870152908601511685850152606090930192908501906001016125eb565b5091979650505050505050565b60006020828403121561264c57600080fd5b5035919050565b6000806040838503121561266657600080fd5b61266f836123c8565b915061267d602084016123c8565b90509250929050565b60005b838110156126a1578181015183820152602001612689565b838111156126b0576000848401525b50505050565b60208152600082518060208401526126d5816040850160208701612686565b601f01601f19169190910160400192915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060001982141561275e5761275e612734565b5060010190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60008160001904831182151516156127b6576127b6612734565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826127e0576127e06127bb565b500490565b600082198211156127f8576127f8612734565b500190565b60008282101561280f5761280f612734565b500390565b600181811c9082168061282857607f821691505b6020821081141561284957634e487b7160e01b600052602260045260246000fd5b50919050565b600082601f83011261286057600080fd5b815161286e6124c28261242b565b81815284602083860101111561288357600080fd5b6121e2826020830160208701612686565b600080604083850312156128a757600080fd5b825167ffffffffffffffff808211156128bf57600080fd5b6128cb8683870161284f565b935060208501519150808211156128e157600080fd5b506128ee8582860161284f565b9150509250929050565b60006020828403121561290a57600080fd5b815167ffffffffffffffff81111561292157600080fd5b6121e28482850161284f565b71161130b734b6b0ba34b7b72fbab936111d1160711b8152815160009061295b816012850160208701612686565b601160f91b6012939091019283015250601301919050565b7003d913730b6b2911d11283934b232903e1607d1b815284516000906129a0816011850160208a01612686565b701116113232b9b1b934b83a34b7b7111d1160791b60119184019182015285516129d1816022840160208a01612686565b6a11161134b6b0b3b2911d1160a91b6022929091019182015284516129fd81602d840160208901612686565b601160f91b602d92909101918201528351612a1f81602e840160208801612686565b607d60f81b602e9290910191820152602f019695505050505050565b600060208284031215612a4d57600080fd5b815180151581146115f257600080fd5b600060208284031215612a6f57600080fd5b5051919050565b600082612a8557612a856127bb565b500690565b600063ffffffff821680612aa057612aa0612734565b6000190192915050565b60008451612abc818460208901612686565b8083019050602f60f81b8082528551612adc816001850160208a01612686565b60019201918201528351612af7816002840160208801612686565b0160020195945050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c000000815260008251612b3c81601d850160208701612686565b91909101601d0192915050565b634e487b7160e01b600052603160045260246000fd5b60008060008060008060c08789031215612b7857600080fd5b865195506020870151945060408701519350606087015192506080870151915060a087015190509295509295509295565b60008251612bbb818460208701612686565b919091019291505056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa264697066735822122091b827c065b50f11c55011c3c3bb44d9a93bfdbd33a770e2e72e4a6baa4dcd1c64736f6c634300080c00330000000000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x60806040526004361061020f5760003560e01c80637d9f6db511610118578063d71d4d72116100a0578063e9dc63751161006f578063e9dc637514610790578063ec91f2a4146107b0578063ed1b3144146107c6578063f25efffc146107db578063f2fde38b146107f057600080fd5b8063d71d4d72146106c6578063d98d6544146106db578063db2e1eed14610758578063e8a3d4851461076e57600080fd5b8063aca3f2a0116100e7578063aca3f2a0146105cb578063b079ac9014610646578063b296024d1461065a578063ce9c7c0d14610686578063d56d229d146106a657600080fd5b80637d9f6db51461050f5780638456cb59146105835780638da5cb5b14610598578063a4d0a17e146105b657600080fd5b80634c85eb1f1161019b578063638a0d4d1161016a578063638a0d4d14610485578063659dd2b4146104a75780636cdcaad5146104ba5780637120334b146104da578063715018a6146104fa57600080fd5b80634c85eb1f1461041e5780635926651d1461042d57806359633a1c1461044d5780635c975abb1461046d57600080fd5b80632782d6c7116101e25780632782d6c7146102c857806336ebdb38146103915780633f4ba83a146103b15780633fc8cef3146103c6578063442b95f7146103fe57600080fd5b806301ffc9a7146102145780630fb5a6b414610249578063150b7a021461026d578063244a5085146102a6575b600080fd5b34801561022057600080fd5b5061023461022f36600461239e565b610810565b60405190151581526020015b60405180910390f35b34801561025557600080fd5b5061025f600a5481565b604051908152602001610240565b34801561027957600080fd5b5061028d610288366004612453565b610862565b6040516001600160e01b03199091168152602001610240565b3480156102b257600080fd5b506102c66102c13660046124fe565b6108b7565b005b3480156102d457600080fd5b506103726102e3366004612519565b600090815260116020908152604080832081516060808201845282546001600160a01b03808216808552600160a01b928390046001600160601b031685890152600190950154938601939093529286526010855294839020835195860184525490811680865291810463ffffffff908116948601859052600160c01b9091041693909101929092529092909150565b604080516001600160a01b039093168352602083019190915201610240565b34801561039d57600080fd5b506102c66103ac366004612543565b610915565b3480156103bd57600080fd5b506102c6610988565b3480156103d257600080fd5b506006546103e6906001600160a01b031681565b6040516001600160a01b039091168152602001610240565b34801561040a57600080fd5b506102c661041936600461257a565b6109e1565b34801561042a57600080fd5b50005b34801561043957600080fd5b506102c66104483660046124fe565b610b20565b34801561045957600080fd5b506102c66104683660046124fe565b610b99565b34801561047957600080fd5b5060035460ff16610234565b34801561049157600080fd5b5061049a610bce565b60405161024091906125ce565b6102c66104b536600461263a565b610ce7565b3480156104c657600080fd5b506102c66104d5366004612653565b610f14565b3480156104e657600080fd5b506102c66104f536600461263a565b610f7c565b34801561050657600080fd5b506102c6610fdb565b34801561051b57600080fd5b50600b54600c54600d54600e54600f5461054b94939291906001600160a01b03811690600160a01b900460ff1686565b6040805196875260208701959095529385019290925260608401526001600160a01b03166080830152151560a082015260c001610240565b34801561058f57600080fd5b506102c661100f565b3480156105a457600080fd5b506005546001600160a01b03166103e6565b3480156105c257600080fd5b506102c6611041565b3480156105d757600080fd5b5061061a6105e63660046124fe565b6010602052600090815260409020546001600160a01b0381169063ffffffff600160a01b8204811691600160c01b90041683565b604080516001600160a01b03909416845263ffffffff9283166020850152911690820152606001610240565b34801561065257600080fd5b506001610234565b34801561066657600080fd5b506009546106749060ff1681565b60405160ff9091168152602001610240565b34801561069257600080fd5b506102c66106a136600461263a565b6110c1565b3480156106b257600080fd5b506017546103e6906001600160a01b031681565b3480156106d257600080fd5b506102c6611120565b3480156106e757600080fd5b5061072b6106f636600461263a565b601160205260009081526040902080546001909101546001600160a01b03821691600160a01b90046001600160601b03169083565b604080516001600160a01b0390941684526001600160601b03909216602084015290820152606001610240565b34801561076457600080fd5b5061025f60085481565b34801561077a57600080fd5b50610783611254565b60405161024091906126b6565b34801561079c57600080fd5b506107836107ab366004612519565b6112e6565b3480156107bc57600080fd5b5061025f60075481565b3480156107d257600080fd5b50610234611496565b3480156107e757600080fd5b506102c66114c7565b3480156107fc57600080fd5b506102c661080b3660046124fe565b611545565b60006001600160e01b0319821663e9dc637560e01b148061084157506001600160e01b03198216632782d6c760e01b145b8061085c57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6017546000906001600160a01b03163314158061088857506001600160a01b0385163014155b156108a65760405163ea8e4eb560e01b815260040160405180910390fd5b50630a85bd0160e11b949350505050565b6005546001600160a01b031633146108ea5760405162461bcd60e51b81526004016108e1906126e9565b60405180910390fd5b6108f56012826115dd565b610912576040516350dce02d60e11b815260040160405180910390fd5b50565b6005546001600160a01b0316331461093f5760405162461bcd60e51b81526004016108e1906126e9565b6009805460ff191660ff83169081179091556040519081527fec5ccd96cc77b6219e9d44143df916af68fc169339ea7de5008ff15eae13450d906020015b60405180910390a150565b6005546001600160a01b031633146109b25760405162461bcd60e51b81526004016108e1906126e9565b6109ba6115f9565b600d5415806109d25750600f54600160a01b900460ff165b156109df576109df61168c565b565b6005546001600160a01b03163314610a0b5760405162461bcd60e51b81526004016108e1906126e9565b63ffffffff8116610a2f57604051630309cb8760e51b815260040160405180910390fd5b6001600160a01b038316610a5657604051630309cb8760e51b815260040160405180910390fd5b6001600160a01b038481166000908152601060205260409020541615610a8f576040516320b10e2b60e11b815260040160405180910390fd5b604080516060810182526001600160a01b03808616825263ffffffff80861660208085019182528683168587019081528a85166000908152601090925295902093518454915195518316600160c01b0263ffffffff60c01b19968416600160a01b026001600160c01b031990931691909416171793909316179055610b199060129086906116d916565b5050505050565b6005546001600160a01b03163314610b4a5760405162461bcd60e51b81526004016108e1906126e9565b6001600160a01b038116610b7157604051630309cb8760e51b815260040160405180910390fd5b610b7c6014826116d9565b61091257604051630309cb8760e51b815260040160405180910390fd5b6005546001600160a01b03163314610bc35760405162461bcd60e51b81526004016108e1906126e9565b610b7c6014826115dd565b60606000610bdc60126116ee565b90508067ffffffffffffffff811115610bf757610bf76123e4565b604051908082528060200260200182016040528015610c4257816020015b6040805160608101825260008082526020808301829052928201528252600019909201910181610c155790505b50915060005b81811015610ce25760106000610c5f6012846116f8565b6001600160a01b039081168252602080830193909352604091820160002082516060810184529054918216815263ffffffff600160a01b8304811694820194909452600160c01b909104909216908201528351849083908110610cc457610cc461271e565b60200260200101819052508080610cda9061274a565b915050610c48565b505090565b60026004541415610d0a5760405162461bcd60e51b81526004016108e190612765565b60026004556040805160c081018252600b54808252600c546020830152600d5492820192909252600e546060820152600f546001600160a01b0381166080830152600160a01b900460ff16151560a0820152908214610d7c5760405163ca20fe1760e01b815260040160405180910390fd5b80606001514210610da057604051630129799f60e21b815260040160405180910390fd5b600854341015610dc3576040516379bb5b6160e01b815260040160405180910390fd5b6009546020820151606491610ddd9160ff9091169061279c565b610de791906127d1565b8160200151610df691906127e5565b341015610e1657604051635069375b60e11b815260040160405180910390fd5b60808101516001600160a01b03811615610e3857610e38818360200151611704565b34600c55600f80546001600160a01b03191633179055600754606083015160009190610e659042906127fd565b1090508015610e8657600754610e7b90426127e5565b60608401819052600e555b8251604080513381523460208201528315158183015290517f1159164c56f277e6fc99c11731bd380e0347deb969b75523398734c252706ea39181900360600190a28015610f0957825160608401516040519081527f6e912a3a9105bdd2af817ba5adc14e6c127c1035b5b648faa29ca0d58ab8ff4e9060200160405180910390a25b505060016004555050565b6001600160a01b03828116600090815260106020526040902054163314610f4e5760405163ea8e4eb560e01b815260040160405180910390fd5b6001600160a01b03918216600090815260106020526040902080546001600160a01b03191691909216179055565b6005546001600160a01b03163314610fa65760405162461bcd60e51b81526004016108e1906126e9565b60078190556040518181527f1b55d9f7002bda4490f467e326f22a4a847629c0f2d1ed421607d318d25b410d9060200161097d565b6005546001600160a01b031633146110055760405162461bcd60e51b81526004016108e1906126e9565b6109df60006117f3565b6005546001600160a01b031633146110395760405162461bcd60e51b81526004016108e1906126e9565b6109df611845565b60035460ff1661108a5760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016108e1565b600260045414156110ad5760405162461bcd60e51b81526004016108e190612765565b60026004556110ba6118c0565b6001600455565b6005546001600160a01b031633146110eb5760405162461bcd60e51b81526004016108e1906126e9565b60088190556040518181527f6ab2e127d7fdf53b8f304e59d3aab5bfe97979f52a85479691a6fab27a28a6b29060200161097d565b6005546001600160a01b0316331461114a5760405162461bcd60e51b81526004016108e1906126e9565b6000611154611aaf565b9050806001146111775760405163ecdd1c2960e01b815260040160405180910390fd5b600a546362977ef09060009061118d90836127e5565b600084815260116020908152604080832080546001600160a01b0316600160a01b6001600160601b03891602179055805160c081018252878152808301849052808201879052606081018590526080810184905260a001839052600b879055600c92909255600d859055600e839055600f80546001600160a81b0319169055815185815290810183905291925084917fd6eddd1118d71820909c1197aa966dbc15ed6f508554252169cc3d5ccac756ca910160405180910390a261124f6115f9565b505050565b60606002805461126390612814565b80601f016020809104026020016040519081016040528092919081815260200182805461128f90612814565b80156112dc5780601f106112b1576101008083540402835291602001916112dc565b820191906000526020600020905b8154815290600101906020018083116112bf57829003601f168201915b5050505050905090565b600081815260116020908152604080832081516060808201845282546001600160a01b038116808452600160a01b9091046001600160601b03169583019590955260019092015481840181905292516316166e1560e31b8152600481019390935290939092909182919063b0b370a890602401600060405180830381865afa158015611376573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261139e9190810190612894565b9150915061148c6113bb84602001516001600160601b0316611c5e565b84600001516001600160a01b0316637284e4166040518163ffffffff1660e01b8152600401600060405180830381865afa1580156113fd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261142591908101906128f8565b8460008551116114445760405180602001604052806000815250611465565b84604051602001611455919061292d565b6040516020818303038152906040525b6040516020016114789493929190612973565b604051602081830303815290604052611cba565b9695505050505050565b6017546000906001600160a01b03166114c15750601780546001600160a01b03191633179055600190565b50600090565b600260045414156114ea5760405162461bcd60e51b81526004016108e190612765565b600260045560035460ff16156115355760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016108e1565b61153d6118c0565b6110ba61168c565b6005546001600160a01b0316331461156f5760405162461bcd60e51b81526004016108e1906126e9565b6001600160a01b0381166115d45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016108e1565b610912816117f3565b60006115f2836001600160a01b038416611ceb565b9392505050565b60035460ff166116425760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016108e1565b6003805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b60008061169842611dde565b5091509150816107e61415806116af575080600614155b156116cd576040516381bf7f6760e01b815260040160405180910390fd5b6116d5611ec3565b5050565b60006115f2836001600160a01b038416611f84565b600061085c825490565b60006115f28383611fd3565b61170e8282611ffd565b6116d557600660009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0826040518263ffffffff1660e01b81526004016000604051808303818588803b15801561176257600080fd5b505af1158015611776573d6000803e3d6000fd5b505060065460405163a9059cbb60e01b81526001600160a01b03878116600483015260248201879052909116935063a9059cbb925060440190506020604051808303816000875af11580156117cf573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061124f9190612a3b565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60035460ff161561188b5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016108e1565b6003805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861166f3390565b6040805160c081018252600b548152600c546020820152600d54918101829052600e546060820152600f546001600160a01b0381166080830152600160a01b900460ff16151560a082015290611929576040516301dff5d560e71b815260040160405180910390fd5b8060a001511561194c57604051634f4fee1760e01b815260040160405180910390fd5b806060015142101561197157604051636463738960e01b815260040160405180910390fd5b600f805460ff60a01b1916600160a01b1790556119966017546001600160a01b031690565b6001600160a01b03166323b872dd3060006001600160a01b031684608001516001600160a01b0316146119cd5783608001516119da565b6005546001600160a01b03165b845160405160e085901b6001600160e01b03191681526001600160a01b0393841660048201529290911660248301526044820152606401600060405180830381600087803b158015611a2b57600080fd5b505af1158015611a3f573d6000803e3d6000fd5b50505050602081015115611a5f57611a5f8160000151826020015161207b565b80516080820151602080840151604080516001600160a01b039094168452918301527fc9f72b276a388619c6d185d146697036241880c36654b1a3ffdad07c24038d99910160405180910390a250565b6017546040516335313c2160e11b815230600482015260009182916001600160a01b0390911690636a627842906024016020604051808303816000875af1158015611afe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b229190612a5d565b6040516bffffffffffffffffffffffff193360601b166020820152426034820152446054820152607481018290529091506000906094016040516020818303038152906040528051906020012090506000611b92611b8060126116ee565b611b8a9084612a76565b6012906116f8565b6001600160a01b0381166000908152601060205260409020805491925090601890611bc990600160c01b900463ffffffff16612a8a565b91906101000a81548163ffffffff021916908363ffffffff160217905563ffffffff1660001415611c0157611bff6012826115dd565b505b604080516060810182526001600160a01b0392831681526001600160601b03428116602080840191825283850196875260008881526011909152939093209151925116600160a01b02919092161781559051600190910155919050565b60606000806000611c6e85611dde565b925092509250611c7d836120e4565b611c86836120e4565b611c8f836120e4565b604051602001611ca193929190612aaa565b6040516020818303038152906040529350505050919050565b6060611cc5826121ea565b604051602001611cd59190612b04565b6040516020818303038152906040529050919050565b60008181526001830160205260408120548015611dd4576000611d0f6001836127fd565b8554909150600090611d23906001906127fd565b9050818114611d88576000866000018281548110611d4357611d4361271e565b9060005260206000200154905080876000018481548110611d6657611d6661271e565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611d9957611d99612b49565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061085c565b600091505061085c565b6000806000804660011415611e0857507323d23d8f243e57d0b924bff3a3191078af325101611e28565b4660041415611e28575073047c6386c30e785f7a8fd536945410802a6053955b6001600160a01b03811615611eb157604051630ea1c16960e41b8152600481018690526001600160a01b0382169063ea1c16909060240160c060405180830381865afa158015611e7c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ea09190612b5f565b509397509195509350611ebb915050565b6107e69350600692505b509193909250565b6000611ecd611aaf565b90508015611f7c57600a544290600090611ee790836127e5565b6040805160c08101825285815260006020808301829052828401879052606083018590526080830182905260a0909201819052600b879055600c55600d859055600e839055600f80546001600160a81b0319169055815185815290810183905291925084917fd6eddd1118d71820909c1197aa966dbc15ed6f508554252169cc3d5ccac756ca910160405180910390a2505050565b610912611845565b6000818152600183016020526040812054611fcb5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561085c565b50600061085c565b6000826000018281548110611fea57611fea61271e565b9060005260206000200154905092915050565b6040805160008082526020820190925281906001600160a01b0385169061753090859060405161202d9190612ba9565b600060405180830381858888f193505050503d806000811461206b576040519150601f19603f3d011682016040523d82523d6000602084013e612070565b606091505b509095945050505050565b6000606461208a83600a61279c565b61209491906127d1565b6000848152601160209081526040808320546001600160a01b0390811684526010909252909120549192506120ca911682611704565b61124f6120d5612352565b6120df83856127fd565b611704565b6060816121085750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612132578061211c8161274a565b915061212b9050600a836127d1565b915061210c565b60008167ffffffffffffffff81111561214d5761214d6123e4565b6040519080825280601f01601f191660200182016040528015612177576020820181803683370190505b5090505b84156121e25761218c6001836127fd565b9150612199600a86612a76565b6121a49060306127e5565b60f81b8183815181106121b9576121b961271e565b60200101906001600160f81b031916908160001a9053506121db600a866127d1565b945061217b565b949350505050565b606081516000141561220a57505060408051602081019091526000815290565b6000604051806060016040528060408152602001612bc6604091399050600060038451600261223991906127e5565b61224391906127d1565b61224e90600461279c565b9050600061225d8260206127e5565b67ffffffffffffffff811115612275576122756123e4565b6040519080825280601f01601f19166020018201604052801561229f576020820181803683370190505b509050818152600183018586518101602084015b8183101561230d5760039283018051603f601282901c811687015160f890811b8552600c83901c8216880151811b6001860152600683901c8216880151811b60028601529116860151901b938201939093526004016122b3565b600389510660018114612327576002811461233857612344565b613d3d60f01b600119830152612344565b603d60f81b6000198301525b509398975050505050505050565b60008061235f60146116ee565b601654909150600061237c6123748484612a76565b6014906116f8565b90508261238a8360016127e5565b6123949190612a76565b6016559392505050565b6000602082840312156123b057600080fd5b81356001600160e01b0319811681146115f257600080fd5b80356001600160a01b03811681146123df57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715612423576124236123e4565b604052919050565b600067ffffffffffffffff821115612445576124456123e4565b50601f01601f191660200190565b6000806000806080858703121561246957600080fd5b612472856123c8565b9350612480602086016123c8565b925060408501359150606085013567ffffffffffffffff8111156124a357600080fd5b8501601f810187136124b457600080fd5b80356124c76124c28261242b565b6123fa565b8181528860208385010111156124dc57600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b60006020828403121561251057600080fd5b6115f2826123c8565b6000806040838503121561252c57600080fd5b612535836123c8565b946020939093013593505050565b60006020828403121561255557600080fd5b813560ff811681146115f257600080fd5b803563ffffffff811681146123df57600080fd5b6000806000806080858703121561259057600080fd5b612599856123c8565b93506125a7602086016123c8565b92506125b560408601612566565b91506125c360608601612566565b905092959194509250565b602080825282518282018190526000919060409081850190868401855b8281101561262d57815180516001600160a01b031685528681015163ffffffff90811688870152908601511685850152606090930192908501906001016125eb565b5091979650505050505050565b60006020828403121561264c57600080fd5b5035919050565b6000806040838503121561266657600080fd5b61266f836123c8565b915061267d602084016123c8565b90509250929050565b60005b838110156126a1578181015183820152602001612689565b838111156126b0576000848401525b50505050565b60208152600082518060208401526126d5816040850160208701612686565b601f01601f19169190910160400192915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060001982141561275e5761275e612734565b5060010190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60008160001904831182151516156127b6576127b6612734565b500290565b634e487b7160e01b600052601260045260246000fd5b6000826127e0576127e06127bb565b500490565b600082198211156127f8576127f8612734565b500190565b60008282101561280f5761280f612734565b500390565b600181811c9082168061282857607f821691505b6020821081141561284957634e487b7160e01b600052602260045260246000fd5b50919050565b600082601f83011261286057600080fd5b815161286e6124c28261242b565b81815284602083860101111561288357600080fd5b6121e2826020830160208701612686565b600080604083850312156128a757600080fd5b825167ffffffffffffffff808211156128bf57600080fd5b6128cb8683870161284f565b935060208501519150808211156128e157600080fd5b506128ee8582860161284f565b9150509250929050565b60006020828403121561290a57600080fd5b815167ffffffffffffffff81111561292157600080fd5b6121e28482850161284f565b71161130b734b6b0ba34b7b72fbab936111d1160711b8152815160009061295b816012850160208701612686565b601160f91b6012939091019283015250601301919050565b7003d913730b6b2911d11283934b232903e1607d1b815284516000906129a0816011850160208a01612686565b701116113232b9b1b934b83a34b7b7111d1160791b60119184019182015285516129d1816022840160208a01612686565b6a11161134b6b0b3b2911d1160a91b6022929091019182015284516129fd81602d840160208901612686565b601160f91b602d92909101918201528351612a1f81602e840160208801612686565b607d60f81b602e9290910191820152602f019695505050505050565b600060208284031215612a4d57600080fd5b815180151581146115f257600080fd5b600060208284031215612a6f57600080fd5b5051919050565b600082612a8557612a856127bb565b500690565b600063ffffffff821680612aa057612aa0612734565b6000190192915050565b60008451612abc818460208901612686565b8083019050602f60f81b8082528551612adc816001850160208a01612686565b60019201918201528351612af7816002840160208801612686565b0160020195945050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c000000815260008251612b3c81601d850160208701612686565b91909101601d0192915050565b634e487b7160e01b600052603160045260246000fd5b60008060008060008060c08789031215612b7857600080fd5b865195506020870151945060408701519350606087015192506080870151915060a087015190509295509295509295565b60008251612bbb818460208701612686565b919091019291505056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa264697066735822122091b827c065b50f11c55011c3c3bb44d9a93bfdbd33a770e2e72e4a6baa4dcd1c64736f6c634300080c0033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

0000000000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : weth_ (address): 0x0000000000000000000000000000000000000000

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000000


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
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.