ETH Price: $2,902.96 (+2.88%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Set Approval For...211321992024-11-07 0:29:4732 hrs ago1730939387IN
Brotchain: BROT Token
0 ETH0.0008763718.69557332
Safe Transfer Fr...211321932024-11-07 0:28:3532 hrs ago1730939315IN
Brotchain: BROT Token
0 ETH0.0015903717.16815145
Safe Transfer Fr...209192992024-10-08 7:15:2331 days ago1728371723IN
Brotchain: BROT Token
0 ETH0.0012350413.33751731
Safe Transfer Fr...209044972024-10-06 5:43:2333 days ago1728193403IN
Brotchain: BROT Token
0 ETH0.000319673.49284564
Set Approval For...208982362024-10-05 8:47:5934 days ago1728118079IN
Brotchain: BROT Token
0 ETH0.000219764.68825633
Set Approval For...208552172024-09-29 8:51:5940 days ago1727599919IN
Brotchain: BROT Token
0 ETH0.000456839.7455517
Set Approval For...207324682024-09-12 5:33:1157 days ago1726119191IN
Brotchain: BROT Token
0 ETH0.000081091.73001096
Set Approval For...207291182024-09-11 18:19:5957 days ago1726078799IN
Brotchain: BROT Token
0 ETH0.000193464.12718114
Set Approval For...207287892024-09-11 17:14:1157 days ago1726074851IN
Brotchain: BROT Token
0 ETH0.000118872.53600771
Reset Palette207141952024-09-09 16:17:4759 days ago1725898667IN
Brotchain: BROT Token
0 ETH0.0010467819.31159765
Set Approval For...206215782024-08-27 18:01:2372 days ago1724781683IN
Brotchain: BROT Token
0 ETH0.000094942.02548259
Set Approval For...206215692024-08-27 17:59:3572 days ago1724781575IN
Brotchain: BROT Token
0 ETH0.000097672.08359379
Set Approval For...205186522024-08-13 8:57:1186 days ago1723539431IN
Brotchain: BROT Token
0 ETH0.000105632.25348203
Set Approval For...205162082024-08-13 0:45:3587 days ago1723509935IN
Brotchain: BROT Token
0 ETH0.000267945.71609174
Set Approval For...203985612024-07-27 14:43:59103 days ago1722091439IN
Brotchain: BROT Token
0 ETH0.000267945.71597425
Set Approval For...203985562024-07-27 14:42:59103 days ago1722091379IN
Brotchain: BROT Token
0 ETH0.000269695.74313309
Set Palette202432952024-07-05 22:28:47125 days ago1720218527IN
Brotchain: BROT Token
0 ETH0.000368372.12038991
Set Palette202432662024-07-05 22:22:59125 days ago1720218179IN
Brotchain: BROT Token
0 ETH0.000344531.99204701
Set Palette202432482024-07-05 22:19:23125 days ago1720217963IN
Brotchain: BROT Token
0 ETH0.001472622.3
Safe Transfer Fr...202432252024-07-05 22:14:47125 days ago1720217687IN
Brotchain: BROT Token
0 ETH0.000195412.11830217
Set Palette202432192024-07-05 22:13:35125 days ago1720217615IN
Brotchain: BROT Token
0 ETH0.000523282.16940937
Set Palette202431922024-07-05 22:08:11125 days ago1720217291IN
Brotchain: BROT Token
0 ETH0.000337922.19187395
Set Palette202431682024-07-05 22:03:23125 days ago1720217003IN
Brotchain: BROT Token
0 ETH0.0016812.71188344
Set Approval For...202431482024-07-05 21:59:23125 days ago1720216763IN
Brotchain: BROT Token
0 ETH0.00011252.4
Set Palette202431332024-07-05 21:56:23125 days ago1720216583IN
Brotchain: BROT Token
0 ETH0.000421752.4
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
151413642022-07-14 14:41:21847 days ago1657809681
Brotchain: BROT Token
0.314159 ETH
141982652022-02-13 14:17:56998 days ago1644761876
Brotchain: BROT Token
0.314159 ETH
133139232021-09-28 11:16:171136 days ago1632827777
Brotchain: BROT Token
0.314159 ETH
133139232021-09-28 11:16:171136 days ago1632827777
Brotchain: BROT Token
0.314159 ETH
132254002021-09-14 18:20:461150 days ago1631643646
Brotchain: BROT Token
0.314159 ETH
132254002021-09-14 18:20:461150 days ago1631643646
Brotchain: BROT Token
0.314159 ETH
132201512021-09-13 22:44:131151 days ago1631573053
Brotchain: BROT Token
0.314159 ETH
132201512021-09-13 22:44:131151 days ago1631573053
Brotchain: BROT Token
0.314159 ETH
132201422021-09-13 22:42:261151 days ago1631572946
Brotchain: BROT Token
0.314159 ETH
132201422021-09-13 22:42:261151 days ago1631572946
Brotchain: BROT Token
0.314159 ETH
131925892021-09-09 16:27:351155 days ago1631204855
Brotchain: BROT Token
0.314159 ETH
131925892021-09-09 16:27:351155 days ago1631204855
Brotchain: BROT Token
0.314159 ETH
131215082021-08-29 16:42:141166 days ago1630255334
Brotchain: BROT Token
0.314159 ETH
131215082021-08-29 16:42:141166 days ago1630255334
Brotchain: BROT Token
0.314159 ETH
131132582021-08-28 10:11:501167 days ago1630145510
Brotchain: BROT Token
0.314159 ETH
131132582021-08-28 10:11:501167 days ago1630145510
Brotchain: BROT Token
0.314159 ETH
131128482021-08-28 8:39:351168 days ago1630139975
Brotchain: BROT Token
0.314159 ETH
131128482021-08-28 8:39:351168 days ago1630139975
Brotchain: BROT Token
0.314159 ETH
131128202021-08-28 8:32:431168 days ago1630139563
Brotchain: BROT Token
0.314159 ETH
131128202021-08-28 8:32:431168 days ago1630139563
Brotchain: BROT Token
0.314159 ETH
131105962021-08-28 0:09:201168 days ago1630109360
Brotchain: BROT Token
0.314159 ETH
131105962021-08-28 0:09:201168 days ago1630109360
Brotchain: BROT Token
0.314159 ETH
131069212021-08-27 10:19:571168 days ago1630059597
Brotchain: BROT Token
0.314159 ETH
131069212021-08-27 10:19:571168 days ago1630059597
Brotchain: BROT Token
0.314159 ETH
131068332021-08-27 9:59:161168 days ago1630058356
Brotchain: BROT Token
0.314159 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Brotchain

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 1 runs

Other Settings:
default evmVersion
File 1 of 21 : Brotchain.sol
// SPDX-License-Identifier: MIT
// Copyright 2021 Arran Schlosberg / Twitter @divergence_art
pragma solidity >=0.8.0 <0.9.0;

/*

  ____            _       _           _       
 |  _ \          | |     | |         (_)      
 | |_) |_ __ ___ | |_ ___| |__   __ _ _ _ __  
 |  _ <| '__/ _ \| __/ __| '_ \ / _` | | '_ \ 
 | |_) | | | (_) | || (__| | | | (_| | | | | |
 |____/|_|  \___/ \__\___|_| |_|\__,_|_|_| |_|
                                              

"In-chain" generative art, Brots are BMP images generated and rendered entirely
by this contract. No externalities, no rendering dependencies—just 100%
Solidity.

================================================================================

Generated by brooksMatelskiOf(0):
                                .                               
                         ...............                        
                     .......................                    
                   ...........................                  
                 ...............................                
               ...................................              
              .....................................             
             .......................................            
           ...........................................          
          .............................................         
         ...............................................        
        .................................................       
        .................................................       
       ...................................................      
      ...................'''```'''.........................     
     ..................''''``^```'''........................    
     .................''''````",$''''.......................    
    ................''''''````"^``''''.......................   
    ...............''''''```"^$"^```'''......................   
   ...............'''''`````,$$$!````''.......................  
   ..............'''''``````:$$$l`````''......................  
  .............'''''``^^^`^^"$$$"^^```^''...................... 
  ............''''````^:,^Y$$$$$$/$^,^^`'......................
  ...........''```````^I$#$$$$$$$$$I$|"``'..................... 
  .........''````````^^,$$$$$$$$$$$$$$^``'..................... 
 ........''``````````"$$$$$$$$$$$$$$$_^``'......................
 .....'''```"````````:$$$$$$$$$$$$$$$$,!`''.....................
 ...''''````^,^^,"^^^}$$$$$$$$$$$$$$$$$^`''.....................
 .'''''`````^:$$$l:^"$$$$$$$$$$$$$$$$$$"`''.....................
 '''''``````")$$$$$<,$$$$$$$$$$$$$$$$$$``''.....................
 ''''`````^^,$$$$$$$;$$$$$$$$$$$$$$$$$,``''.....................
 ````````^,$}$$$$$$$<$$$$$$$$$$$$$$$$$```''.....................
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$^```''.....................
 ````````^,$}$$$$$$$<$$$$$$$$$$$$$$$$$```''.....................
 ''''`````^^,$$$$$$$;$$$$$$$$$$$$$$$$$,``''.....................
 '''''``````")$$$$$<,$$$$$$$$$$$$$$$$$$``''.....................
 .'''''`````^:$$$l:^"$$$$$$$$$$$$$$$$$$"`''.....................
 ...''''````^,^^,"^^^}$$$$$$$$$$$$$$$$$^`''.....................
 .....'''```"````````:$$$$$$$$$$$$$$$$,!`''.....................
 ........''``````````"$$$$$$$$$$$$$$$_^``'......................
  .........''````````^^,$$$$$$$$$$$$$$^``'..................... 
  ...........''```````^I$#$$$$$$$$$I$|"``'.....................
  ............''''````^:,^Y$$$$$$/$^,^^`'...................... 
  .............'''''``^^^`^^"$$$"^^```^''...................... 
   ..............'''''``````:$$$l`````''......................  
   ...............'''''`````,$$$!````''.......................  
    ...............''''''```"^$"^```'''......................   
    ................''''''````"^``''''.......................   
     .................''''````",$''''.......................    
     ..................''''``^```'''........................    
      ...................'''```'''.........................     
       ...................................................      
        .................................................       
        .................................................       
         ...............................................        
          .............................................         
           ...........................................          
             .......................................            
              .....................................             
               ...................................              
                 ...............................                
                   ...........................                  
                     .......................                    
                         ...............                        
*/

import "./BaseOpenSea.sol";
import "./BMP.sol";
import "./Mandelbrot.sol";
import "openzeppelin-solidity/contracts/access/Ownable.sol";
import "openzeppelin-solidity/contracts/security/PullPayment.sol";
import "openzeppelin-solidity/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "openzeppelin-solidity/contracts/token/ERC721/extensions/ERC721Pausable.sol";
import "openzeppelin-solidity/contracts/utils/Strings.sol";

contract Brotchain is BaseOpenSea, ERC721Enumerable, ERC721Pausable, Ownable, PullPayment {
    /**
     * @dev A BMP pixel encoder, supporting arbitrary colour palettes.
     */
    BMP public immutable _bmp;

    /**
     * @dev A Mandelbrot-and-friends fractal generator.
     */
    Mandelbrot public immutable _brots;

    /**
     * @dev Maximum number of editions per series.
     */
    uint256 public constant MAX_PER_SERIES = 64;

    /**
     * @dev Mint price = pi/10.
     */
    uint256 public constant MINT_PRICE = (314159 ether) / 1000000;

    constructor(string memory name, string memory symbol, address brots, address openSeaProxyRegistry) ERC721(name, symbol) {
        _bmp = new BMP();
        _brots = Mandelbrot(brots);

        if (openSeaProxyRegistry != address(0)) {
            _setOpenSeaRegistry(openSeaProxyRegistry);
        }
    }

    /**
     * @dev Base config for pricing + all tokens in a series.
     */
    struct Series {
        uint256[] patches;
        uint256 numMinted;
        uint32 width;
        uint32 height;
        bytes defaultPalette;
        bool locked;
        string name;
        string description;
    }

    /**
     * @dev All existing series configs.
     */
    Series[] public seriesConfigs;

    /**
     * @dev Require that the series exists.
     */
    modifier seriesMustExist(uint256 seriesId) {
        require(seriesId < seriesConfigs.length, "Series doesn't exist");
        _;
    }

    /**
     * @dev Creates a new series of brots, based on the precomputed patches.
     *
     * The seriesId MUST be equal to seriesConfigs.length. This is a safety
     * measure for automated deployment of multiple series in case an earlier
     * transaction fails as series would otherwise be created out of order. This
     * effectively makes newSeries() idempotent.
     */
    function newSeries(uint256 seriesId, string memory name, string memory description, uint256[] memory patches, uint32 width, uint32 height) external onlyOwner {
        require(seriesId == seriesConfigs.length, "Invalid new series ID");
        
        seriesConfigs.push(Series({
            name: name,
            description: description,
            patches: patches,
            width: width,
            height: height,
            numMinted: 0,
            locked: false,
            defaultPalette: new bytes(0)
        }));
        emit SeriesPixelsChanged(seriesId);
    }

    /**
     * @dev Require that the series isn't locked to updates.
     */
    modifier seriesNotLocked(uint256 seriesId) {
        require(!seriesConfigs[seriesId].locked, "Series locked");
        _;
    }

    /**
     * @dev Permanently lock the series to changes in pixels.
     */
    function lockSeries(uint256 seriesId) external seriesMustExist(seriesId) onlyOwner {
        Series memory series = seriesConfigs[seriesId];
        uint256 length;
        for (uint i = 0; i < series.patches.length; i++) {
            length += _brots.cachedPatch(series.patches[i]).pixels.length;
        }
        require(series.width * series.height == length, "Invalid dimensions");
        
        seriesConfigs[seriesId].locked = true;
    }

    /**
     * @dev Emitted when a series' patches or dimensions change.
     */
    event SeriesPixelsChanged(uint256 indexed seriesId);

    /**
     * @dev Update the patches that govern series pixels.
     */
    function setSeriesPatches(uint256 seriesId, uint256[] memory patches) external seriesMustExist(seriesId) seriesNotLocked(seriesId) onlyOwner {
        seriesConfigs[seriesId].patches = patches;
        emit SeriesPixelsChanged(seriesId);
    }

    /**
     * @dev Update the dimensions of the series.
     */
    function setSeriesDimensions(uint256 seriesId, uint32 width, uint32 height) external seriesMustExist(seriesId) seriesNotLocked(seriesId) onlyOwner {
        seriesConfigs[seriesId].width = width;
        seriesConfigs[seriesId].height = height;
        emit SeriesPixelsChanged(seriesId);
    }

    /**
     * @dev Update the default palette for a series when the token doesn't have one.
     */
    function setSeriesDefaultPalette(uint256 seriesId, bytes memory palette) external seriesMustExist(seriesId) seriesNotLocked(seriesId) onlyOwner {
        require(palette.length == 768, "256 colours required");
        seriesConfigs[seriesId].defaultPalette = palette;
    }

    /**
     * @dev Update the series name.
     */
    function setSeriesName(uint256 seriesId, string memory name) external seriesMustExist(seriesId) onlyOwner {
        seriesConfigs[seriesId].name = name;
    }

    /**
     * @dev Update the series description.
     */
    function setSeriesDescription(uint256 seriesId, string memory description) external seriesMustExist(seriesId) onlyOwner {
        seriesConfigs[seriesId].description = description;
    }

    /**
     * @dev Token configuration such as series (pixels).
     */
    struct TokenConfig {
        uint256 paletteChanges;
        address paletteBy;
        address paletteApproval;
        // paletteReset is actually a boolean, but sized to align with a 256-bit
        // boundary for better storage. See resetPalette();
        uint192 paletteReset;
        bytes palette;
    }

    /**
     * @dev All existing token configs.
     */
    mapping(uint256 => TokenConfig) public tokenConfigs;
    
    /**
     * @dev Whether to limit minting only to those in _earlyAccess mapping.
     */
    bool public onlyEarlyAccess = true;

    /**
     * @dev Addresses with early minting access.
     */
    mapping(address => uint256) private _earlyAccess;

    /**
     * @dev Emitted when setOnlyEarlyAccess(to) is called.
     */
    event OnlyEarlyAccess();

    /**
     * @dev Set the onlyEarlyAccess flag.
     */
    function setOnlyEarlyAccess(bool to) external onlyOwner {
        onlyEarlyAccess = to;
        emit OnlyEarlyAccess();
    }

    /**
     * @dev Call parameter for early access because mapping()s are disallowed.
     */
    struct EarlyAccess {
        address addr;
        uint256 totalAllowed;
    }

    /**
     * @dev Set early-access granting or revocation for the addresses.
     *
     * The supply is not the amount left, but the total in the early-access
     * phase.
     */
    function setEarlyAccessGrants(EarlyAccess[] calldata addresses) external onlyOwner {
        for (uint i = 0; i < addresses.length; i++) {
            _earlyAccess[addresses[i].addr] = addresses[i].totalAllowed;
        }
    }

    /**
     * @dev Returns the total early-access allocation for the address.
     */
    function earlyAccessFor(address addr) public view returns (uint256) {
        return _earlyAccess[addr];
    }

    /**
     * @dev Max number that the contract owner can mint in a specific series.
     */
    uint256 public constant OWNER_ALLOCATION = 2;

    /**
     * @dev Allow minting of the genesis pieces.
     */
    function safeMintInSeries(uint256 seriesId) external seriesMustExist(seriesId) onlyOwner {
        require(seriesConfigs[seriesId].numMinted < OWNER_ALLOCATION, "Don't be greedy");
        _safeMintInSeries(seriesId);
    }

    /**
     * @dev Mint one edition, from a randomly selected series.
     *
     * # NB see the bug described in _safeMintInSeries().
     */
    function safeMint() external payable {
        require(msg.value >= MINT_PRICE, "Insufficient payment");
        _asyncTransfer(owner(), msg.value);

        uint256 numSeries = seriesConfigs.length;
        // We need some sort of randomness to choose which series is issued
        // next. sha3 is, by nature of being a cryptographic hash, a good PRNG.
        // Although this can technically be manipulated by someone in control of
        // block.timestamp, they're in a race against other blocks and also the
        // last minted (which is also random). If you can control this and care
        // enough to do so, then you deserve to choose which series you get!
        uint256 rand = uint256(keccak256(abi.encodePacked(
            _msgSender(),
            block.timestamp,
            lastTokenMinted
        ))) % numSeries; // uniform if numSeries is a power of 2 (it is)
        
        // Try each, starting from a random index, until a series with
        // capacity is found.
        for (uint256 i = 0; i < numSeries; i++) {
            uint256 seriesId = (rand + i) % numSeries;
            if (seriesConfigs[seriesId].numMinted < MAX_PER_SERIES) {
                _safeMintInSeries(seriesId);
                return;
            }
        }
        revert("All series sold out");
    }

    /**
     * @dev Last tokenId minted.
     *
     * This doesn't increment because the series could be different to the one
     * before. It's useful for randomly choosing the next token and for testing
     * too. Even at a gas price of 100, updating this only costs 0.0005 ETH.
     */
    uint256 public lastTokenMinted;

    /**
     * @dev Value by which seriesId is multiplied for the prefix of a tokenId.
     *
     * Series 0 will have tokens 0, 1, 2…; series 1 will have tokens 1000, 1001,
     * etc.
     */
    uint256 private constant _tokenIdSeriesMultiplier = 1e4;

    /**
     * @dev Returns the seriesId of a token. The token may not exist.
     */
    function tokenSeries(uint256 tokenId) public pure returns (uint256) {
        return tokenId / _tokenIdSeriesMultiplier;
    }

    /**
     * @dev Returns a token's edition within its series. The token may not exist.
     */
    function tokenEditionNum(uint256 tokenId) public pure returns (uint256) {
        return tokenId % _tokenIdSeriesMultiplier;
    }

    /**
     * @dev Mints the next token in the series.
     */
    function _safeMintInSeries(uint256 seriesId) internal seriesMustExist(seriesId) {
        /**
         * ################################
         * There is a bug in this code that we only discovered after deployment.
         * A minter can move their piece to a different wallet, reducing their
         * balance, and then mint again. See GermanBakery.sol for the fix.
         * ################################
         */
        if (_msgSender() != owner()) {
            if (onlyEarlyAccess) {
                require(balanceOf(_msgSender()) < _earlyAccess[_msgSender()], "Early access exhausted for wallet");
            } else {
                require(balanceOf(_msgSender()) < seriesConfigs.length, "Wallet cap reached");
            }
        }

        Series memory series = seriesConfigs[seriesId];
        uint256 tokenId = seriesId * _tokenIdSeriesMultiplier + series.numMinted;
        lastTokenMinted = tokenId;

        tokenConfigs[tokenId] = TokenConfig({
            paletteChanges: 0,
            paletteBy: address(0),
            paletteApproval: address(0),
            paletteReset: 0,
            palette: new bytes(0)
        });
        seriesConfigs[seriesId].numMinted++;

        _safeMint(_msgSender(), tokenId);
        emit TokenBMPChanged(tokenId);
    }

    /**
     * @dev Emitted when the address is approved to change a token's palette.
     */
    event PaletteApproval(uint256 indexed tokenId, address approved);

    /**
     * @dev Approve the address to change the token's palette.
     *
     * Set to 0x00 address to revoke. Token owner and ERC721 approved already
     * have palette approval. This is to allow someone else to modify a palette
     * without the risk of them transferring the token.
     *
     * Revoked upon token transfer.
     */
    function approveForPalette(uint256 tokenId, address approved) external {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "Only owner or approver");
        address owner = ownerOf(tokenId);
        require(approved != owner, "Approving token owner");
        
       tokenConfigs[tokenId].paletteApproval = approved;
        emit PaletteApproval(tokenId, approved);
    }

    /**
     * @dev Emitted to signal changing of a token's BMP.
     */
    event TokenBMPChanged(uint256 indexed tokenId);

    /**
     * @dev Require that the message sender is approved for palette changes.
     */
    modifier approvedForPalette(uint256 tokenId) {
        require(
            _isApprovedOrOwner(_msgSender(), tokenId) ||
            tokenConfigs[tokenId].paletteApproval == _msgSender(),
            "Not approved for palette"
        );
        _;
    }

    /**
     * @dev Clear a token's palette, using the series default instead.
     *
     * Does not reset the paletteChanges count, but increments it.
     *
     * Emits TokenBMPChanged(tokenId);
     */
    function resetPalette(uint256 tokenId) approvedForPalette(tokenId) external {
        require(tokenConfigs[tokenId].paletteReset == 0, "Already reset");
        
        tokenConfigs[tokenId].paletteChanges++;
        tokenConfigs[tokenId].paletteBy = address(0);
        // Initial palette setting costs about 0.01 ETH at 30 gas but changes
        // are a little over 25% of that. Using a boolean for reset adds
        // negligible cost to the reset, in exchange for  greater savings on the
        // next setPalette() call.
        tokenConfigs[tokenId].paletteReset = 1;
        
        emit TokenBMPChanged(tokenId);
    }

    /**
     * @dev Set a token's palette if an owner or has approval.
     *
     * Emits TokenBMPChanged(tokenId).
     */
    function setPalette(uint256 tokenId, bytes memory palette) approvedForPalette(tokenId) external {
        require(palette.length == 768, "256 colours required");
        
        tokenConfigs[tokenId].palette = palette;
        tokenConfigs[tokenId].paletteChanges++;
        tokenConfigs[tokenId].paletteBy = _msgSender();
        tokenConfigs[tokenId].paletteReset = 0;
        
        emit TokenBMPChanged(tokenId);
    }

    /**
     * @dev Concatenates a series' patches into a single array.
     */
    function seriesPixels(uint256 seriesId) public view seriesMustExist(seriesId) returns (bytes memory) {
        return _brots.concatenatePatches(seriesConfigs[seriesId].patches);
    }

    /**
     * @dev Token equivalent of seriesPixels().
     */
    function pixelsOf(uint256 tokenId) public view returns (bytes memory) {
        require(_exists(tokenId), "Token doesn't exist");
        return seriesPixels(tokenSeries(tokenId));
    }

    /**
     * @dev Returns the effective token palette, considering resets.
     *
     * Boolean flag indicates whether it's the original palette; i.e. nothing is
     * set or the palette has been explicitly reset().
     */
    function _tokenPalette(uint256 tokenId) private view returns (bytes memory, bool) {
        TokenConfig memory token = tokenConfigs[tokenId];
        bytes memory palette = token.palette;
        bool original = token.paletteReset == 1 || palette.length == 0;
        
        if (original) {
            palette = seriesConfigs[tokenSeries(tokenId)].defaultPalette;
            if (palette.length == 0) {
                palette = _bmp.grayscale();
            }
        }
        
        return (palette, original);
    }

    /**
     * @dev Returns the BMP-encoded token image, scaling pixels in both dimensions.
     *
     * Scale of 0 is treated as 1.
     */
    function bmpOf(uint256 tokenId, uint32 scale) public view returns (bytes memory) {
        require(_exists(tokenId), "Token doesn't exist");
        Series memory series = seriesConfigs[tokenSeries(tokenId)];
        (bytes memory palette, ) = _tokenPalette(tokenId);
        
        bytes memory pixels = pixelsOf(tokenId);
        if (scale > 1) {
            return _bmp.bmp(
                _bmp.scalePixels(pixels, series.width, series.height, scale),
                series.width * scale,
                series.height * scale,
                palette
            );
        }
        return _bmp.bmp(pixels, series.width, series.height, palette);
    }

    /**
     * @dev Equivalent to bmpOf() but encoded as a data URI to view in a browser.
     */
    function bmpDataURIOf(uint256 tokenId, uint32 scale) public view returns (string memory) {
        return _bmp.bmpDataURI(bmpOf(tokenId, scale));
    }

    /**
     * @dev Renders the token as an ASCII brot.
     *
     * This is an homage to Robert W Brooks and Peter Matelski who were the
     * first to render the Mandelbrot, in this form.
     */
    function brooksMatelskiOf(uint256 tokenId, string memory characters) external view returns (string memory) {
        bytes memory charset = abi.encodePacked(characters);
        require(charset.length == 256, "256 characters");

        Series memory series = seriesConfigs[tokenSeries(tokenId)];
        // Include newlines except for the end.
        bytes memory ascii = new bytes((series.width+1)*series.height - 1);
        
        bytes memory pixels = pixelsOf(tokenId);

        uint col;
        uint a; // ascii index
        for (uint p = 0; p < pixels.length; p++) {
            ascii[a] = charset[uint8(pixels[p])];
            a++;
            col++;
            
            if (col == series.width && a < ascii.length) {
                ascii[a] = 0x0a; // Not compatible with Windows and typewriters.
                a++;
                col = 0;
            }
        }

        return string(ascii);
    }

    /**
     * @dev Base URL for external_url metadata field.
     */
    string private _baseExternalUrl = "https://brotchain.art/brot/";

    /**
     * @dev Set the base URL for external_url metadata field.
     */
    function setBaseExternalUrl(string memory url) public onlyOwner {
        _baseExternalUrl = url;
    }

    /**
     * @dev Returns data URI of token metadata.
     *
     * The BMP-encoded image is included in its own base64-encoded data URI.
     */
    function tokenURI(uint256 tokenId) public override view returns (string memory) {
        TokenConfig memory token = tokenConfigs[tokenId];
        Series memory series = seriesConfigs[tokenSeries(tokenId)];
        uint256 editionNum = tokenEditionNum(tokenId);

        bytes memory data = abi.encodePacked(
            'data:application/json,{',
                '"name":"', series.name, ' #', Strings.toString(editionNum) ,'",',
                '"description":"', series.description, '",'
                '"external_url":"', _baseExternalUrl, Strings.toString(tokenId),'",'
        );

        // Combining this packing with the one above would result in the stack
        // being too deep and a failure to compile.
        data = abi.encodePacked(
            data,
            '"attributes":['
                '{"value":"', series.name, '"},'
                '{',
                    '"trait_type":"Palette Changes",',
                    '"value":', Strings.toString(token.paletteChanges),
                '}'
        );

        if (token.paletteBy != address(0)) {
            data = abi.encodePacked(
                data,
                ',{',
                    '"trait_type":"Palette By",',
                    '"value":"', Strings.toHexString(uint256(uint160(token.paletteBy)), 20),'"',
                '}'
            );
        }

        (, bool original) = _tokenPalette(tokenId);
        if (original) {
            data = abi.encodePacked(
                data,
                ',{"value":"Original Palette"}'
            );
        }      
        if (editionNum == 0) {
            data = abi.encodePacked(
                data,
                ',{"value":"Genesis"}'
            );
        }

        return string(abi.encodePacked(
            data,
                '],',
                '"image":"', bmpDataURIOf(tokenId, 1), '"',
            '}'
        ));
    }

    /**
     * @dev Pause the contract.
     */
    function pause() external onlyOwner {
        _pause();
    }

    /**
     * @dev Unpause the contract.
     */
    function unpause() external onlyOwner {
        _unpause();
    }

    function isApprovedForAll(address owner, address operator) public view override returns (bool) {
        return super.isApprovedForAll(owner, operator) || isOwnersOpenSeaProxy(owner, operator);
    }

    /**
     * @dev OpenSea collection config.
     *
     * https://docs.opensea.io/docs/contract-level-metadata
     */
    function setContractURI(string memory contractURI) external onlyOwner {
        _setContractURI(contractURI);
    }

    /**
     * @dev Revoke palette approval upon token transfer.
     */
    function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual override(ERC721Enumerable, ERC721Pausable) {
        tokenConfigs[tokenId].paletteApproval = address(0);
        super._beforeTokenTransfer(from, to, tokenId);
    }

    function supportsInterface(bytes4 interfaceId) public view override (ERC721, ERC721Enumerable) returns (bool) {
        return super.supportsInterface(interfaceId);
    }
}

File 2 of 21 : base64.sol
// SPDX-License-Identifier: MIT

/// @title Base64
/// @author Brecht Devos - <[email protected]>
/// @notice Provides a function for encoding some bytes in base64
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;
    }
}

File 3 of 21 : Ownable.sol
// SPDX-License-Identifier: MIT

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() {
        _setOwner(_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 {
        _setOwner(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");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 4 of 21 : Pausable.sol
// SPDX-License-Identifier: MIT

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 5 of 21 : PullPayment.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../utils/escrow/Escrow.sol";

/**
 * @dev Simple implementation of a
 * https://consensys.github.io/smart-contract-best-practices/recommendations/#favor-pull-over-push-for-external-calls[pull-payment]
 * strategy, where the paying contract doesn't interact directly with the
 * receiver account, which must withdraw its payments itself.
 *
 * Pull-payments are often considered the best practice when it comes to sending
 * Ether, security-wise. It prevents recipients from blocking execution, and
 * eliminates reentrancy concerns.
 *
 * 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].
 *
 * To use, derive from the `PullPayment` contract, and use {_asyncTransfer}
 * instead of Solidity's `transfer` function. Payees can query their due
 * payments with {payments}, and retrieve them with {withdrawPayments}.
 */
abstract contract PullPayment {
    Escrow private immutable _escrow;

    constructor() {
        _escrow = new Escrow();
    }

    /**
     * @dev Withdraw accumulated payments, forwarding all gas to the recipient.
     *
     * Note that _any_ account can call this function, not just the `payee`.
     * This means that contracts unaware of the `PullPayment` protocol can still
     * receive funds this way, by having a separate account call
     * {withdrawPayments}.
     *
     * WARNING: Forwarding all gas opens the door to reentrancy vulnerabilities.
     * Make sure you trust the recipient, or are either following the
     * checks-effects-interactions pattern or using {ReentrancyGuard}.
     *
     * @param payee Whose payments will be withdrawn.
     */
    function withdrawPayments(address payable payee) public virtual {
        _escrow.withdraw(payee);
    }

    /**
     * @dev Returns the payments owed to an address.
     * @param dest The creditor's address.
     */
    function payments(address dest) public view returns (uint256) {
        return _escrow.depositsOf(dest);
    }

    /**
     * @dev Called by the payer to store the sent amount as credit to be pulled.
     * Funds sent in this way are stored in an intermediate {Escrow} contract, so
     * there is no danger of them being spent before withdrawal.
     *
     * @param dest The destination address of the funds.
     * @param amount The amount to transfer.
     */
    function _asyncTransfer(address dest, uint256 amount) internal virtual {
        _escrow.deposit{value: amount}(dest);
    }
}

File 6 of 21 : ERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

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

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

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: balance query for the zero address");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: owner query for nonexistent token");
        return owner;
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

        string memory baseURI = _baseURI();
        return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
    }

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, can be overriden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        require(operator != _msgSender(), "ERC721: approve to caller");

        _operatorApprovals[_msgSender()][operator] = approved;
        emit ApprovalForAll(_msgSender(), operator, approved);
    }

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

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");

        _transfer(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
        _safeTransfer(from, to, tokenId, _data);
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _owners[tokenId] != address(0);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _mint(to, tokenId);
        require(
            _checkOnERC721Received(address(0), to, tokenId, _data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId);

        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId);

        // Clear approvals
        _approve(address(0), tokenId);

        _balances[owner] -= 1;
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId);

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits a {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param _data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                return retval == IERC721Receiver(to).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 7 of 21 : IERC721.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

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

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

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

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;
}

File 8 of 21 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

File 9 of 21 : ERC721Enumerable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../ERC721.sol";
import "./IERC721Enumerable.sol";

/**
 * @dev This implements an optional extension of {ERC721} defined in the EIP that adds
 * enumerability of all the token ids in the contract as well as all token ids owned by each
 * account.
 */
abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
    // Mapping from owner to list of owned token IDs
    mapping(address => mapping(uint256 => uint256)) private _ownedTokens;

    // Mapping from token ID to index of the owner tokens list
    mapping(uint256 => uint256) private _ownedTokensIndex;

    // Array with all token ids, used for enumeration
    uint256[] private _allTokens;

    // Mapping from token id to position in the allTokens array
    mapping(uint256 => uint256) private _allTokensIndex;

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

    /**
     * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
        return _ownedTokens[owner][index];
    }

    /**
     * @dev See {IERC721Enumerable-totalSupply}.
     */
    function totalSupply() public view virtual override returns (uint256) {
        return _allTokens.length;
    }

    /**
     * @dev See {IERC721Enumerable-tokenByIndex}.
     */
    function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
        return _allTokens[index];
    }

    /**
     * @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` cannot be the zero address.
     * - `to` cannot be the zero address.
     *
     * 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 override {
        super._beforeTokenTransfer(from, to, tokenId);

        if (from == address(0)) {
            _addTokenToAllTokensEnumeration(tokenId);
        } else if (from != to) {
            _removeTokenFromOwnerEnumeration(from, tokenId);
        }
        if (to == address(0)) {
            _removeTokenFromAllTokensEnumeration(tokenId);
        } else if (to != from) {
            _addTokenToOwnerEnumeration(to, tokenId);
        }
    }

    /**
     * @dev Private function to add a token to this extension's ownership-tracking data structures.
     * @param to address representing the new owner of the given token ID
     * @param tokenId uint256 ID of the token to be added to the tokens list of the given address
     */
    function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
        uint256 length = ERC721.balanceOf(to);
        _ownedTokens[to][length] = tokenId;
        _ownedTokensIndex[tokenId] = length;
    }

    /**
     * @dev Private function to add a token to this extension's token tracking data structures.
     * @param tokenId uint256 ID of the token to be added to the tokens list
     */
    function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
        _allTokensIndex[tokenId] = _allTokens.length;
        _allTokens.push(tokenId);
    }

    /**
     * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that
     * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for
     * gas optimizations e.g. when performing a transfer operation (avoiding double writes).
     * This has O(1) time complexity, but alters the order of the _ownedTokens array.
     * @param from address representing the previous owner of the given token ID
     * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address
     */
    function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
        // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
        uint256 tokenIndex = _ownedTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary
        if (tokenIndex != lastTokenIndex) {
            uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];

            _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
            _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
        }

        // This also deletes the contents at the last position of the array
        delete _ownedTokensIndex[tokenId];
        delete _ownedTokens[from][lastTokenIndex];
    }

    /**
     * @dev Private function to remove a token from this extension's token tracking data structures.
     * This has O(1) time complexity, but alters the order of the _allTokens array.
     * @param tokenId uint256 ID of the token to be removed from the tokens list
     */
    function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
        // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and
        // then delete the last slot (swap and pop).

        uint256 lastTokenIndex = _allTokens.length - 1;
        uint256 tokenIndex = _allTokensIndex[tokenId];

        // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so
        // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding
        // an 'if' statement (like in _removeTokenFromOwnerEnumeration)
        uint256 lastTokenId = _allTokens[lastTokenIndex];

        _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
        _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index

        // This also deletes the contents at the last position of the array
        delete _allTokensIndex[tokenId];
        _allTokens.pop();
    }
}

File 10 of 21 : ERC721Pausable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../ERC721.sol";
import "../../../security/Pausable.sol";

/**
 * @dev ERC721 token with pausable token transfers, minting and burning.
 *
 * Useful for scenarios such as preventing trades until the end of an evaluation
 * period, or having an emergency switch for freezing all token transfers in the
 * event of a large bug.
 */
abstract contract ERC721Pausable is ERC721, Pausable {
    /**
     * @dev See {ERC721-_beforeTokenTransfer}.
     *
     * Requirements:
     *
     * - the contract must not be paused.
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual override {
        super._beforeTokenTransfer(from, to, tokenId);

        require(!paused(), "ERC721Pausable: token transfer while paused");
    }
}

File 11 of 21 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

File 12 of 21 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

File 13 of 21 : Address.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) private 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 14 of 21 : Context.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

File 15 of 21 : Strings.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

File 16 of 21 : Escrow.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "../../access/Ownable.sol";
import "../Address.sol";

/**
 * @title Escrow
 * @dev Base escrow contract, holds funds designated for a payee until they
 * withdraw them.
 *
 * Intended usage: This contract (and derived escrow contracts) should be a
 * standalone contract, that only interacts with the contract that instantiated
 * it. That way, it is guaranteed that all Ether will be handled according to
 * the `Escrow` rules, and there is no need to check for payable functions or
 * transfers in the inheritance tree. The contract that uses the escrow as its
 * payment method should be its owner, and provide public methods redirecting
 * to the escrow's deposit and withdraw.
 */
contract Escrow is Ownable {
    using Address for address payable;

    event Deposited(address indexed payee, uint256 weiAmount);
    event Withdrawn(address indexed payee, uint256 weiAmount);

    mapping(address => uint256) private _deposits;

    function depositsOf(address payee) public view returns (uint256) {
        return _deposits[payee];
    }

    /**
     * @dev Stores the sent amount as credit to be withdrawn.
     * @param payee The destination address of the funds.
     */
    function deposit(address payee) public payable virtual onlyOwner {
        uint256 amount = msg.value;
        _deposits[payee] += amount;
        emit Deposited(payee, amount);
    }

    /**
     * @dev Withdraw accumulated balance for a payee, forwarding all gas to the
     * recipient.
     *
     * WARNING: Forwarding all gas opens the door to reentrancy vulnerabilities.
     * Make sure you trust the recipient, or are either following the
     * checks-effects-interactions pattern or using {ReentrancyGuard}.
     *
     * @param payee The address whose funds will be withdrawn and transferred to.
     */
    function withdraw(address payable payee) public virtual onlyOwner {
        uint256 payment = _deposits[payee];

        _deposits[payee] = 0;

        payee.sendValue(payment);

        emit Withdrawn(payee, payment);
    }
}

File 17 of 21 : ERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

File 18 of 21 : IERC165.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

File 19 of 21 : BMP.sol
// SPDX-License-Identifier: MIT
// Copyright 2021 Arran Schlosberg / Twitter @divergence_art
pragma solidity >=0.8.0 <0.9.0;

import "base64-sol/base64.sol";

/**
 * @dev 8-bit BMP encoding with arbitrary colour palettes.
 */
contract BMP {
    using Base64 for string;

    /**
     * @dev Returns an 8-bit grayscale palette for bitmap images.
     */
    function grayscale() public pure returns (bytes memory) {
        bytes memory palette = new bytes(768);
        // TODO: investigate a way around using ++ += or + on a bytes1 without
        // having to use a placeholder int8 for incrementing!
        uint8 j;
        bytes1 b;
        for (uint16 i = 0; i < 768; i += 3) {
            b = bytes1(j);
            palette[i  ] = b;
            palette[i+1] = b;
            palette[i+2] = b;
            // The last increment would revert if checked.
            unchecked { j++; }
        }
        return palette;
    }

    /**
     * @dev Returns an 8-bit BMP encoding of the pixels.
     *
     * Spec: https://www.digicamsoft.com/bmp/bmp.html
     *
     * Layout description with offsets:
     * http://www.ece.ualberta.ca/~elliott/ee552/studentAppNotes/2003_w/misc/bmp_file_format/bmp_file_format.htm
     *
     * N.B. Everything is little-endian, hence the assembly for masking and
     * shifting.
     */
    function bmp(bytes memory pixels, uint32 width, uint32 height, bytes memory palette) public pure returns (bytes memory) {
        require(width * height == pixels.length, "Invalid dimensions");
        require(palette.length == 768, "256 colours required");

        // 14 bytes for BITMAPFILEHEADER + 40 for BITMAPINFOHEADER + 1024 for palette
        bytes memory buf = new bytes(1078);

        // BITMAPFILEHEADER
        buf[0] = 0x42; buf[1] = 0x4d; // bfType = BM
        
        uint32 size = 1078 + uint32(pixels.length);
        // bfSize; bytes in the entire buffer
        uint32 b;
        for (uint i = 2; i < 6; i++) {
            assembly {
                b := and(size, 0xff)
                size := shr(8, size)
            }
            buf[i] = bytes1(uint8(b));
        }

        // Next 4 bytes are bfReserved1 & 2; both = 0 = initial value

        // bfOffBits; bytes from beginning of file to pixels = 14 + 40 + 1024
        // (see size above)
        buf[0x0a] = 0x36;
        buf[0x0b] = 0x04;

        // BITMAPINFOHEADER
        // biSize; bytes in this struct = 40
        buf[0x0e] = 0x28;

        // biWidth / biHeight
        for (uint i = 0x12; i < 0x16; i++) {
            assembly {
                b := and(width, 0xff)
                width := shr(8, width)
            }
            buf[i] = bytes1(uint8(b));
        }
        for (uint i = 0x16; i < 0x1a; i++) {
            assembly {
                b := and(height, 0xff)
                height := shr(8, height)
            }
            buf[i] = bytes1(uint8(b));
        }

        // biPlanes
        buf[0x1a] = 0x01;
        // biBitCount
        buf[0x1c] = 0x08;

        // I've decided to use raw pixels instead of run-length encoding for
        // compression as these aren't being stored. It's therefore simpler to
        // avoid the extra computation. Therefore biSize can be 0. Similarly
        // there's no point checking exactly which colours are used, so
        // biClrUsed and biClrImportant can be 0 to indicate all colours. This
        // is therefore the end of BITMAPINFOHEADER. Simples.

        uint j = 54;
        for (uint i = 0; i < 768; i += 3) {
            // RGBQUAD is in reverse order and the 4th byte is unused.
            buf[j  ] = palette[i+2];
            buf[j+1] = palette[i+1];
            buf[j+2] = palette[i  ];
            j += 4;
        }

        return abi.encodePacked(buf, pixels);
    }

    /**
     * @dev Returns the buffer, presumably from bmp(), as a base64 data URI.
     */
    function bmpDataURI(bytes memory bmpBuf) public pure returns (string memory) {
        return string(abi.encodePacked(
            'data:image/bmp;base64,',
            Base64.encode(bmpBuf)
        ));
    }

    /**
     * @dev Scale pixels by repetition along both axes.
     */
    function scalePixels(bytes memory pixels, uint32 width, uint32 height, uint32 scale) public pure returns (bytes memory) {
        require(width * height == pixels.length, "Invalid dimensions");
        bytes memory scaled = new bytes(pixels.length * scale * scale);

        // Indices in each of the original and scaled buffers, respectively. The
        // scaled-buffer index is always incremented. The original index is
        // incremented only after scaling x-wise by scale times, then reversed
        // at the end of the width to allow for y-wise scaling.
        uint32 origIdx;
        uint32 scaleIdx;
        for (uint32 y = 0; y < height; y++) {
            for (uint32 yScale = 0; yScale < scale; yScale++) {
                for (uint32 x = 0; x < width; x++) {
                    for (uint32 xScale = 0; xScale < scale; xScale++) {
                        scaled[scaleIdx] = pixels[origIdx];
                        scaleIdx++;
                    }
                    origIdx++;
                }
                // Rewind to copy the row again.
                origIdx -= width;
            }
            // Don't just copy the first row.
            origIdx += width;
        }

        return scaled;
    }

}

File 20 of 21 : BaseOpenSea.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

// https://gist.github.com/dievardump/483eb43bc6ed30b14f01e01842e3339b/

/// @title OpenSea contract helper that defines a few things
/// @author Simon Fremaux (@dievardump)
/// @dev This is a contract used to add OpenSea's support for gas-less trading
///      by checking if operator is owner's proxy
contract BaseOpenSea {
    string private _contractURI;
    ProxyRegistry private _proxyRegistry;

    /// @notice Returns the contract URI function. Used on OpenSea to get details
    ///         about a contract (owner, royalties etc...)
    ///         See documentation: https://docs.opensea.io/docs/contract-level-metadata
    function contractURI() public view returns (string memory) {
        return _contractURI;
    }

    /// @notice Helper for OpenSea gas-less trading
    /// @dev Allows to check if `operator` is owner's OpenSea proxy
    /// @param owner the owner we check for
    /// @param operator the operator (proxy) we check for
    function isOwnersOpenSeaProxy(address owner, address operator)
        public
        view
        returns (bool)
    {
        ProxyRegistry proxyRegistry = _proxyRegistry;
        return
            // we have a proxy registry address
            address(proxyRegistry) != address(0) &&
            // current operator is owner's proxy address
            address(proxyRegistry.proxies(owner)) == operator;
    }

    /// @dev Internal function to set the _contractURI
    /// @param contractURI_ the new contract uri
    function _setContractURI(string memory contractURI_) internal {
        _contractURI = contractURI_;
    }

    /// @dev Internal function to set the _proxyRegistry
    /// @param proxyRegistryAddress the new proxy registry address
    function _setOpenSeaRegistry(address proxyRegistryAddress) internal {
        _proxyRegistry = ProxyRegistry(proxyRegistryAddress);
    }
}

contract OwnableDelegateProxy {}

contract ProxyRegistry {
    mapping(address => OwnableDelegateProxy) public proxies;
}

File 21 of 21 : Mandelbrot.sol
// SPDX-License-Identifier: MIT
// Copyright 2021 Arran Schlosberg / Twitter @divergence_art
pragma solidity >=0.8.0 <0.9.0;

import "openzeppelin-solidity/contracts/access/Ownable.sol";

/**
 * @dev Pure-Solidity rendering of Mandelbrot and similar fractals.
 */
contract Mandelbrot is Ownable {
    /**
     * @dev Defines the fixed-point precision for non-integer numbers.
     *
     * The number 1 is represented as 1<<PRECISION, 0.5 as 1<<(PRECISION-1).
     * These values can be thought of as the binary equivalent of working in
     * cents vs dollars (100c = $1) which is the same 2 _decimal_ precision.
     *
     * Addition functions as normal. Multiplication results in twice as many
     * fractional bits so requires devision by the "dollar-equivalent":
     * 
     *   $1 × $2 = $2
     *   100c × 200c = 20,000 (extra precision) / 100 = $2
     *
     * The binary equivalent of this division is a right arithmetic shift (sar)
     * to maintain the sign. The specific value was chosen to avoid overflow
     * based on Mandelbrot escape conditions. Although it's possible to first
     * right-shift both the multiplier and multiplicand by PRECISION/2 and then
     * multiply in order to allow higher values, this changes gas from 8 to 11
     * as mul=5 and sar=3.
     */
    uint256 private constant PRECISION = 125;

    /**
     * @dev Pre-computed value for PRECISION+2.
     */
    uint256 private constant PRECISION_PLUS_2 = 127;

    /**
     * @dev The number 1 in @PRECISION fixed-point representation.
     *
     * This is useful for external callers, which should use ONE as bignum menas
     * of computing fractions.
     */
    int256 public constant ONE = 2**125;

    /**
     * @dev The number 2 in @PRECISION fixed-point representation.
     */
    int256 private constant TWO = 2**126;

    /**
     * @dev By now I think you can see the pattern.
     */
    int256 private constant FOUR = 2**127;

    /**
     * @dev You're gonna have to trust me on this one!
     */
    int256 private constant POINT_FOUR = 0xccccccccccccccccccccccccccccccc;

    /**
     * @dev Some bounds checks for inclusion in the cardioid, main bulb, etc.
     */
    int256 private constant QUARTER = 2**123;
    int256 private constant EIGHTH = 2**122;
    int256 private constant SIXTEENTH = 2**121;
    int256 private constant NEG_THREE_QUARTERS = 2**123 - 2**125;
    int256 private constant NEG_ONE_PT_TWO_FIVE = -(2**123 + 2**125);

    /**
     * @dev The number -2 in @PRECISION fixed-point representation.
     *
     * This is the lower bound of the parts of real and imaginary axes on which
     * fractals are defined.
     */
    int256 public constant NEG_TWO = -TWO;

    /**
     * @dev Supported Mandelbrot-derived fractals.
     *
     * The INVALID sentinel value MUST be last as it allows for rapid checking
     * of valid values with <.
     */
    enum Fractal {
        Mandelbrot,
        Mandelbar,
        Multi3,
        BurningShip,

        INVALID
    }

    /**
     * @dev Parameters for computing a patch in a fractal.
     */
    struct Patch {
        // Fixed-point values, not actually integers. See ONE.
        int256 minReal;
        int256 minImaginary;
        // Dimensions in pixels. Pixel width is controlled by zoomLog2.
        int256 width;
        int256 height;
        // For a full fractal, set equal width and height, and
        // zoomLog2 = log_2(width).
        int16 zoomLog2;
        uint8 maxIterations;
        Fractal fractal;
    }

    /**
     * @dev Computes escape times (pixel values) for a fractal rendering.
     *
     * These are the components that make up the final image when concatenated,
     * but are computed piecemeal to save compute time of any single call.
     */
    function patchPixels(Patch memory patch) public pure returns (bytes memory) {
        require(patch.width > 0, "Non-positive width");
        require(patch.height > 0, "Non-positive height");
        require(patch.zoomLog2 > 0, "Non-positive zoom");
        require(patch.fractal < Fractal.INVALID, "Unsupported fractal");

        // Mandelbrots are defined on [-2,2] (i.e. width 4 = 2^2), hence the use
        // of PRECISION+2. Every increment of zoomLog2 increases the
        // mangification of both axes 2× by halving the pixelWidth.
        int256 pixelWidth;
        {
            int16 zoomLog2 = patch.zoomLog2;
            assembly { pixelWidth := shl(sub(PRECISION_PLUS_2, zoomLog2), 1) }
        }
        int256 maxRe = patch.minReal + pixelWidth*patch.width;
        int256 maxIm = patch.minImaginary + pixelWidth*patch.height;

        // While this duplicates a lot of code, it saves having the if statement
        // inside the loops, which would be much less efficient.
        if (patch.fractal == Fractal.Mandelbrot) {
            return _mandelbrot(patch, pixelWidth, maxRe, maxIm);
        } else if (patch.fractal == Fractal.Mandelbar) {
            return _mandelbar(patch, pixelWidth, maxRe, maxIm);
        } else if (patch.fractal == Fractal.Multi3) {
            return _multi3(patch, pixelWidth, maxRe, maxIm);
        } else if (patch.fractal == Fractal.BurningShip) {
            return _burningShip(patch, pixelWidth, maxRe, maxIm);
        }
        // The check for patch.fractal < Fractal.INVALID makes this impossible,
        // but we still need a return value.
        return new bytes(0);
    }

    /**
     * @dev Computes the standard Mandelbrot.
     */
    function _mandelbrot(Patch memory patch, int256 pixelWidth, int256 maxRe, int256 maxIm) internal pure returns (bytes memory) {
        bytes memory pixels = new bytes(uint256(patch.width * patch.height));
        
        int256 zRe;
        int256 zIm;
        int256 reSq;
        int256 imSq;

        uint8 maxIters  = patch.maxIterations;
        uint256 pixelIdx = 0;
        for (int256 cIm = patch.minImaginary; cIm < maxIm; cIm += pixelWidth) {
            for (int256 cRe = patch.minReal; cRe < maxRe; cRe += pixelWidth) {
                // Points in the Mandelbrot are expensive to compute by force
                // because they require maxIters iterations. Ruling out the two
                // largest areas adds a little more computation to other
                // regions, but is a net saving.
                //
                // From https://en.wikipedia.org/wiki/Plotting_algorithms_for_the_Mandelbrot_set#Border_tracing_/_edge_checking
                //
                // NOTE: to keep the stack small, all variable names are
                // overloaded with different meanings. It's ugly, but so be it.

                // TODO: the checks are only performed based on real ranges;
                // test if there's a benefit to computing |cIm| and limiting
                // further. At this point the speed-up is good enough to render
                // a 256x256 fairly quickly, for some subjective definition of
                // "fairly".

                // Inside the cardioid?
                if (cRe >= NEG_THREE_QUARTERS && cRe < POINT_FOUR) {
                    zRe = cRe - QUARTER;
                    zIm = cIm;
                    assembly {
                        reSq := shr(PRECISION, mul(zRe, zRe)) // (x - 1/4)^2
                        imSq := shr(PRECISION, mul(zIm, zIm)) // y^2
                        zIm := add(reSq, imSq) // q
                        zRe := add(zRe, zIm) // q + x - 1/4
                        zRe := sar(PRECISION, mul(zRe, zIm)) // q(q + x - 1/4)
                        imSq := shr(2, imSq) // y^2/4
                    }
                    if (zRe <= imSq) {
                        pixelIdx++;
                        continue;
                    }
                }
                
                // Inside the main bulb?
                if (cRe <= NEG_THREE_QUARTERS && cRe >= NEG_ONE_PT_TWO_FIVE) {
                    zRe = cRe + ONE;
                    zIm = cIm;
                    assembly {
                        reSq := shr(PRECISION, mul(zRe, zRe))
                        imSq := shr(PRECISION, mul(zIm, zIm))
                    }
                    if (reSq + imSq <= SIXTEENTH) {
                        pixelIdx++;
                        continue;
                    }
                }

                // Brute-force computation from here on. Variables now mean what
                // they say on the tin.

                // Technically z_0 = (0,0) but z_1 is always c, so skip that
                // iteration and eke out an extra iteration.
                zRe = cRe;
                zIm = cIm;
                uint8 pixelVal;
                assembly {
                    for { let i := 0 } lt(i, maxIters) { i := add(i, 1) } {
                        reSq := shr(PRECISION, mul(zRe, zRe))
                        imSq := shr(PRECISION, mul(zIm, zIm))
                        
                        if gt(add(reSq, imSq), FOUR) {
                            pixelVal := sub(maxIters, i)
                            i := maxIters
                        }

                        // (x+iy)^2 = (x^2 - y^2) + 2ixy
                        //
                        // mul is 5 gas but add is 3, so 2xy is mul(add(x,x),y) instead
                        // of mul(mul(x,y),2)
                        zIm := add(cIm, sar(PRECISION, mul(add(zRe, zRe), zIm)))
                        zRe := add(cRe, sub(reSq, imSq))

                    } // for maxIters
                } // assembly

                pixels[pixelIdx] = bytes1(pixelVal);
                pixelIdx++;

            } // for cIm
        } // for cRe

        return pixels;
    }

    /**
     * @dev Computes the "Mandelbar", taking the conjugate of z (hence bar).
     *
     * Also known as a "Tricorn". This differs from _mandelbrot() in that it has
     * no efficiency checks, initial zIm = -cIm (not cIm) and the zIm in the
     * assembly block is wrapped in sub(0, …). Each difference is noted with
     * comments.
     */
    function _mandelbar(Patch memory patch, int256 pixelWidth, int256 maxRe, int256 maxIm) internal pure returns (bytes memory) {
        bytes memory pixels = new bytes(uint256(patch.width * patch.height));
        
        int256 zRe;
        int256 zIm;
        int256 reSq;
        int256 imSq;

        uint8 maxIters  = patch.maxIterations;
        uint256 pixelIdx = 0;
        for (int256 cIm = patch.minImaginary; cIm < maxIm; cIm += pixelWidth) {
            for (int256 cRe = patch.minReal; cRe < maxRe; cRe += pixelWidth) {
                // Note: there are no containment checks we can do to reduce
                // brute-force computation.

                // Technically z_0 = (0,0) but z_1 is always c, so skip that
                // iteration and eke out an extra iteration.
                zRe = cRe;
                // Note: the -cIm for the conjugate.
                zIm = -cIm;
                uint8 pixelVal;
                assembly {
                    for { let i := 0 } lt(i, maxIters) { i := add(i, 1) } {
                        reSq := shr(PRECISION, mul(zRe, zRe))
                        imSq := shr(PRECISION, mul(zIm, zIm))
                        
                        if gt(add(reSq, imSq), FOUR) {
                            pixelVal := sub(maxIters, i)
                            i := maxIters
                        }

                        // (x+iy)^2 = (x^2 - y^2) + 2ixy
                        //
                        // mul is 5 gas but add is 3, so 2xy is mul(add(x,x),y) instead
                        // of mul(mul(x,y),2)
                        //
                        // Note: the sub(0, …) is the "bar" part of the fractal.
                        zIm := sub(0, add(cIm, sar(PRECISION, mul(add(zRe, zRe), zIm))))
                        zRe := add(cRe, sub(reSq, imSq))

                    } // for maxIters
                } // assembly

                pixels[pixelIdx] = bytes1(pixelVal);
                pixelIdx++;

            } // for cIm
        } // for cRe

        return pixels;
    }

    /**
     * @dev Computes the 3-headed Multibrot, z_n -> z_n^4 + z_0;
     *
     * This is effectively the same as the Mandelbrot but we square z_n twice.
     * Each difference is noted with comments.
     */
    function _multi3(Patch memory patch, int256 pixelWidth, int256 maxRe, int256 maxIm) internal pure returns (bytes memory) {
        bytes memory pixels = new bytes(uint256(patch.width * patch.height));
        
        int256 zRe;
        int256 zIm;
        int256 reSq;
        int256 imSq;

        uint8 maxIters  = patch.maxIterations;
        uint256 pixelIdx = 0;
        for (int256 cIm = patch.minImaginary; cIm < maxIm; cIm += pixelWidth) {
            for (int256 cRe = patch.minReal; cRe < maxRe; cRe += pixelWidth) {
                // As with the containment tests for the Mandelbrot cardioid and
                // bulb, variable names are sometimes used differently to reduce
                // stack usage. 

                assembly {
                    reSq := shr(PRECISION, mul(cRe, cRe))
                    imSq := shr(PRECISION, mul(cIm, cIm))
                    reSq := add(reSq, imSq) // |z^2|
                }
                if (reSq > FOUR) {
                    // There's odd behaviour in the [-2,-2] corner without this
                    // initial check.
                    pixels[pixelIdx] = bytes1(maxIters);
                    pixelIdx++;
                    continue;
                } else if (reSq < EIGHTH) {
                    // Multibrots have cardioid-oids (great word eh?) that grow
                    // in minimum radius as the power increases. The
                    // Mandelbrot's cardioid inverts to 0.25.
                    // 
                    // TODO: loosen this bound to rule out more computation.
                    pixelIdx++;
                    continue;
                }

                // Brute-force computation from here on. Variables now mean what
                // they say on the tin.

                // Technically z_0 = (0,0) but z_1 is always c, so skip that
                // iteration and eke out an extra iteration.
                zRe = cRe;
                zIm = cIm;
                uint8 pixelVal;
                assembly {
                    for { let i := 0 } lt(i, maxIters) { i := add(i, 1) } {
                        reSq := shr(PRECISION, mul(zRe, zRe))
                        imSq := shr(PRECISION, mul(zIm, zIm))

                        // Note: instead of immediately checking for divergence,
                        // we complete z^2 and then check |z^2|^2 > 4 whereas
                        // the standard Mandelbrot checks |z|^2.
                        //
                        // (x+iy)^2 = (x^2 - y^2) + 2ixy
                        //
                        // mul is 5 gas but add is 3, so 2xy is mul(add(x,x),y) instead
                        // of mul(mul(x,y),2)
                        //
                        // Note: unlike Mandelbrot, we don't add z_0 (c) yet.
                        zIm := sar(PRECISION, mul(add(zRe, zRe), zIm))
                        zRe := sub(reSq, imSq)
                        
                        // // Note: reSq + imSq = |z^2|^2
                        reSq := shr(PRECISION, mul(zRe, zRe))
                        imSq := shr(PRECISION, mul(zIm, zIm))

                        if gt(add(reSq, imSq), FOUR) {
                            pixelVal := sub(maxIters, i)
                            i := maxIters
                        }

                        // Note: same as above except adding c.
                        zIm := add(cIm, sar(PRECISION, mul(add(zRe, zRe), zIm)))
                        zRe := add(cRe, sub(reSq, imSq))

                    } // for maxIters
                } // assembly

                pixels[pixelIdx] = bytes1(pixelVal);
                pixelIdx++;

            } // for cIm
        } // for cRe

        return pixels;
    }

    /**
     * @dev Computes the Burning Ship by using |Re| and |Im|.
     */
    function _burningShip(Patch memory patch, int256 pixelWidth, int256 maxRe, int256 maxIm) internal pure returns (bytes memory) {
        bytes memory pixels = new bytes(uint256(patch.width * patch.height));
        
        int256 zRe;
        int256 zIm;
        int256 reSq;
        int256 imSq;

        uint8 maxIters  = patch.maxIterations;
        uint256 pixelIdx = 0;
        // Note: the burning ship only looks like a ship when the imaginary axis
        // is flipped. Flipping the real is common too.
        for (int256 cIm = maxIm - pixelWidth; cIm >= patch.minImaginary; cIm -= pixelWidth) {
            for (int256 cRe = maxRe - pixelWidth; cRe >= patch.minReal; cRe -= pixelWidth) {
                // Technically z_0 = (0,0) but z_1 is always c, so skip that
                // iteration and eke out an extra iteration.
                zRe = cRe;
                zIm = cIm;
                uint8 pixelVal;
                assembly {
                    for { let i := 0 } lt(i, maxIters) { i := add(i, 1) } {
                        reSq := shr(PRECISION, mul(zRe, zRe))
                        imSq := shr(PRECISION, mul(zIm, zIm))
                        
                        if gt(add(reSq, imSq), FOUR) {
                            pixelVal := sub(maxIters, i)
                            i := maxIters
                        }

                        // (x+iy)^2 = (x^2 - y^2) + 2ixy
                        //
                        // mul is 5 gas but add is 3, so 2xy is mul(add(x,x),y) instead
                        // of mul(mul(x,y),2)
                        zIm := add(cIm, sar(PRECISION, mul(add(zRe, zRe), zIm)))
                        zRe := add(cRe, sub(reSq, imSq))

                        // Note: burning ship is identical to Mandelbrot except
                        // for the absolute values of real and imaginary.
                        if slt(zRe, 0) {
                            zRe := sub(0, zRe)
                        }
                        if slt(zIm, 0) {
                            zIm := sub(0, zIm)
                        }
                    } // for maxIters
                } // assembly

                pixels[pixelIdx] = bytes1(pixelVal);
                pixelIdx++;

            } // for cIm
        } // for cRe

        return pixels;
    }

    /**
     * @dev Precomputed pixels with their generating information.
     */
    struct CachedPatch {
        bytes pixels;
        Patch patch;
    }

    /**
     * @dev A cache of precomputed pixels.
     *
     * Key is patchCacheKey(patch).
     */
    mapping(uint256 => CachedPatch) public patchCache;

    /**
     * @dev Returns the key for the patchCache mapping of this patch.
     */
    function patchCacheKey(Patch memory patch) public pure returns (uint256) {
        return uint256(keccak256(abi.encode(patch)));
    }

    /**
     * @dev Cache a precomputed patch of pixels.
     *
     * See verifyCachedPatch().
     */
    function cachePatch(bytes memory pixels, Patch memory patch) public onlyOwner {
        require(pixels.length == uint256(patch.width * patch.height), "Invalid dimensions");
        patchCache[patchCacheKey(patch)] = CachedPatch(pixels, patch);
    }

    /**
     * @dev Returns a cached patch, confirming existence.
     *
     * As mappings always return a value, width and height both > 0 is used as
     * a proxy for the patch having been cached. Those with 0 area are
     * redundant anyway.
     */
    function cachedPatch(uint256 cacheIdx) public view returns (CachedPatch memory) {
        CachedPatch memory cached = patchCache[cacheIdx];
        require(cached.patch.width > 0 && cached.patch.height > 0, "Patch not cached");
        return cached;
    }

    /**
     * @dev Recompute pixels for a patch and confirm that they match the cache.
     *
     * This contract works on a trust-but-verify model. If patchPixels() were to
     * be used in a transaction, the gas fee would make the entire project
     * infeasible. Instead, it's only used in (free, read-only) calls, and the
     * returned values are stored via cachePatch(), which is cheaper. It's
     * possible to recompute the patch at any time via another free call to
     * verifyCachedPatch().
     */
    function verifyCachedPatch(uint256 cacheIdx) public view returns (bool) {
        CachedPatch memory cached = cachedPatch(cacheIdx);
        bytes memory fresh = patchPixels(cached.patch);
        return keccak256(fresh) == keccak256(cached.pixels);
    }

    /**
     * @dev Returns a concatenated pixel buffer of cached patches.
     */
    function concatenatePatches(uint256[] memory patches) public view returns (bytes memory) {
        CachedPatch[] memory cached = new CachedPatch[](patches.length);

        uint256 len;
        for (uint i = 0; i < patches.length; i++) {
            cached[i] = cachedPatch(patches[i]);
            len += cached[i].pixels.length;
        }

        bytes memory buf = new bytes(len);
        uint idx;
        for (uint i = 0; i < cached.length; i++) {
            for (uint j = 0; j < cached[i].pixels.length; j++) {
                buf[idx] = cached[i].pixels[j];
                idx++;
            }
        }
        return buf;
    }
}

Settings
{
  "remappings": [],
  "optimizer": {
    "enabled": true,
    "runs": 1
  },
  "evmVersion": "london",
  "libraries": {},
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"address","name":"brots","type":"address"},{"internalType":"address","name":"openSeaProxyRegistry","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[],"name":"OnlyEarlyAccess","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"approved","type":"address"}],"name":"PaletteApproval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"seriesId","type":"uint256"}],"name":"SeriesPixelsChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"TokenBMPChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"MAX_PER_SERIES","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINT_PRICE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OWNER_ALLOCATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_bmp","outputs":[{"internalType":"contract BMP","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_brots","outputs":[{"internalType":"contract Mandelbrot","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"approved","type":"address"}],"name":"approveForPalette","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint32","name":"scale","type":"uint32"}],"name":"bmpDataURIOf","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint32","name":"scale","type":"uint32"}],"name":"bmpOf","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"characters","type":"string"}],"name":"brooksMatelskiOf","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"earlyAccessFor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isOwnersOpenSeaProxy","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastTokenMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"seriesId","type":"uint256"}],"name":"lockSeries","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"seriesId","type":"uint256"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"description","type":"string"},{"internalType":"uint256[]","name":"patches","type":"uint256[]"},{"internalType":"uint32","name":"width","type":"uint32"},{"internalType":"uint32","name":"height","type":"uint32"}],"name":"newSeries","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"onlyEarlyAccess","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","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":"dest","type":"address"}],"name":"payments","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"pixelsOf","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"resetPalette","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"safeMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"seriesId","type":"uint256"}],"name":"safeMintInSeries","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"seriesConfigs","outputs":[{"internalType":"uint256","name":"numMinted","type":"uint256"},{"internalType":"uint32","name":"width","type":"uint32"},{"internalType":"uint32","name":"height","type":"uint32"},{"internalType":"bytes","name":"defaultPalette","type":"bytes"},{"internalType":"bool","name":"locked","type":"bool"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"description","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"seriesId","type":"uint256"}],"name":"seriesPixels","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"url","type":"string"}],"name":"setBaseExternalUrl","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"contractURI","type":"string"}],"name":"setContractURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint256","name":"totalAllowed","type":"uint256"}],"internalType":"struct Brotchain.EarlyAccess[]","name":"addresses","type":"tuple[]"}],"name":"setEarlyAccessGrants","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"to","type":"bool"}],"name":"setOnlyEarlyAccess","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"palette","type":"bytes"}],"name":"setPalette","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"seriesId","type":"uint256"},{"internalType":"bytes","name":"palette","type":"bytes"}],"name":"setSeriesDefaultPalette","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"seriesId","type":"uint256"},{"internalType":"string","name":"description","type":"string"}],"name":"setSeriesDescription","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"seriesId","type":"uint256"},{"internalType":"uint32","name":"width","type":"uint32"},{"internalType":"uint32","name":"height","type":"uint32"}],"name":"setSeriesDimensions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"seriesId","type":"uint256"},{"internalType":"string","name":"name","type":"string"}],"name":"setSeriesName","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"seriesId","type":"uint256"},{"internalType":"uint256[]","name":"patches","type":"uint256[]"}],"name":"setSeriesPatches","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenConfigs","outputs":[{"internalType":"uint256","name":"paletteChanges","type":"uint256"},{"internalType":"address","name":"paletteBy","type":"address"},{"internalType":"address","name":"paletteApproval","type":"address"},{"internalType":"uint192","name":"paletteReset","type":"uint192"},{"internalType":"bytes","name":"palette","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenEditionNum","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenSeries","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"payee","type":"address"}],"name":"withdrawPayments","outputs":[],"stateMutability":"nonpayable","type":"function"}]

600f805460ff19166001179055610120604052601b60e08190527f68747470733a2f2f62726f74636861696e2e6172742f62726f742f00000000006101009081526200004f9160129190620001da565b503480156200005d57600080fd5b506040516200794338038062007943833981016040819052620000809162000370565b83518490849062000099906002906020850190620001da565b508051620000af906003906020840190620001da565b5050600c805460ff1916905550620000c73362000180565b604051620000d59062000269565b604051809103906000f080158015620000f2573d6000803e3d6000fd5b5060601b6001600160601b031916608052604051620001119062000277565b604051809103906000f0801580156200012e573d6000803e3d6000fd5b506001600160601b0319606091821b811660a0529083901b1660c0526001600160a01b038116156200017657600180546001600160a01b0319166001600160a01b0383161790555b5050505062000452565b600c80546001600160a01b03838116610100818102610100600160a81b031985161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b828054620001e890620003ff565b90600052602060002090601f0160209004810192826200020c576000855562000257565b82601f106200022757805160ff191683800117855562000257565b8280016001018555821562000257579182015b82811115620002575782518255916020019190600101906200023a565b506200026592915062000285565b5090565b61061780620064c483390190565b610e688062006adb83390190565b5b8082111562000265576000815560010162000286565b80516001600160a01b0381168114620002b457600080fd5b919050565b600082601f830112620002cb57600080fd5b81516001600160401b0380821115620002e857620002e86200043c565b604051601f8301601f19908116603f011681019082821181831017156200031357620003136200043c565b816040528381526020925086838588010111156200033057600080fd5b600091505b8382101562000354578582018301518183018401529082019062000335565b83821115620003665760008385830101525b9695505050505050565b600080600080608085870312156200038757600080fd5b84516001600160401b03808211156200039f57600080fd5b620003ad88838901620002b9565b95506020870151915080821115620003c457600080fd5b50620003d387828801620002b9565b935050620003e4604086016200029c565b9150620003f4606086016200029c565b905092959194509250565b600181811c908216806200041457607f821691505b602082108114156200043657634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052604160045260246000fd5b60805160601c60a05160601c60c05160601c615ffa620004ca600039600081816109a90152818161167901526128340152600081816105270152818161268e01528181612e1201528181612e4101528181612fac01526144030152600081816119be0152818161369f015261408f0152615ffa6000f3fe60806040526004361061029c5760003560e01c806301ffc9a7146102a157806306fdde03146102d6578063081812fc146102f85780630927407214610325578063095ea7b31461034957806309d287d31461036b57806312d829b51461038b57806318160ddd146103ab57806320519aae146103c057806323b872dd146103e05780632635b036146104005780632d5fdb6a146104205780632f745c59146104405780633043ce861461046057806331b3eb941461048057806332bd2d6e146104a057806335036aff146104c05780633cd27480146104e05780633f4ba83a1461050057806342137f081461051557806342842e0e1461054957806344bdde08146105695780634be5eb71146105895780634c0cfe25146105bc5780634f6ccce7146105dc5780635c975abb146105fc5780636102de98146106145780636352211e146106345780636871ee401461065457806370a082311461065c578063715018a61461067c57806378a8b20d146106915780638456cb59146106b157806385df1ac1146106c6578063892d59d1146106e65780638da5cb5b14610706578063938e3d7b1461071b57806394da47e81461073b57806395d89b411461075b578063a22cb46514610770578063ad14282214610790578063adca4df0146107b0578063b7b4c4bc146107d0578063b88d4fde146107f0578063bd685bb114610810578063c002d23d14610846578063c01bd0e914610862578063c2da454714610893578063c506301d146108b3578063c87b56dd146108d3578063d191340c146108f3578063d845c86c1461090d578063dadc179e14610922578063e2982c2114610942578063e8a3d48514610962578063e985e9c514610977578063eef459f614610997578063ef59e0cd146109cb578063f2fde38b146109e0575b600080fd5b3480156102ad57600080fd5b506102c16102bc36600461512f565b610a00565b60405190151581526020015b60405180910390f35b3480156102e257600080fd5b506102eb610a11565b6040516102cd91906159b2565b34801561030457600080fd5b5061031861031336600461532b565b610aa3565b6040516102cd9190615924565b34801561033157600080fd5b5061033b60115481565b6040519081526020016102cd565b34801561035557600080fd5b50610369610364366004615074565b610b30565b005b34801561037757600080fd5b50610369610386366004615382565b610c41565b34801561039757600080fd5b506102eb6103a63660046153c8565b610d33565b3480156103b757600080fd5b50600a5461033b565b3480156103cc57600080fd5b506103696103db3660046154d8565b6111b4565b3480156103ec57600080fd5b506103696103fb366004614f93565b6112f8565b34801561040c57600080fd5b5061036961041b366004615114565b61132a565b34801561042c57600080fd5b5061036961043b36600461532b565b611393565b34801561044c57600080fd5b5061033b61045b366004615074565b6117f1565b34801561046c57600080fd5b5061036961047b36600461535d565b611887565b34801561048c57600080fd5b5061036961049b366004614f3d565b6119a7565b3480156104ac57600080fd5b506103696104bb3660046153c8565b611a28565b3480156104cc57600080fd5b506103696104db36600461532b565b611b3f565b3480156104ec57600080fd5b506103696104fb3660046153c8565b611c04565b34801561050c57600080fd5b50610369611c94565b34801561052157600080fd5b506103187f000000000000000000000000000000000000000000000000000000000000000081565b34801561055557600080fd5b50610369610564366004614f93565b611ccd565b34801561057557600080fd5b5061033b61058436600461532b565b611ce8565b34801561059557600080fd5b506105a96105a436600461532b565b611cf6565b6040516102cd9796959493929190615c3d565b3480156105c857600080fd5b506102eb6105d736600461532b565b611ef3565b3480156105e857600080fd5b5061033b6105f736600461532b565b611f26565b34801561060857600080fd5b50600c5460ff166102c1565b34801561062057600080fd5b506102c161062f366004614f5a565b611fb9565b34801561064057600080fd5b5061031861064f36600461532b565b61206b565b6103696120e2565b34801561066857600080fd5b5061033b610677366004614f3d565b612243565b34801561068857600080fd5b506103696122ca565b34801561069d57600080fd5b5061033b6106ac36600461532b565b612303565b3480156106bd57600080fd5b50610369612311565b3480156106d257600080fd5b506103696106e1366004615404565b612348565b3480156106f257600080fd5b506103696107013660046153c8565b612547565b34801561071257600080fd5b5061031861263b565b34801561072757600080fd5b506103696107363660046151ba565b61264f565b34801561074757600080fd5b506102eb6107563660046154b5565b61268a565b34801561076757600080fd5b506102eb61273c565b34801561077c57600080fd5b5061036961078b36600461503f565b61274b565b34801561079c57600080fd5b506102eb6107ab36600461532b565b61280c565b3480156107bc57600080fd5b506103696107cb3660046150a0565b6128fe565b3480156107dc57600080fd5b506103696107eb3660046153c8565b6129ac565b3480156107fc57600080fd5b5061036961080b366004614fd4565b612a36565b34801561081c57600080fd5b5061033b61082b366004614f3d565b6001600160a01b031660009081526010602052604090205490565b34801561085257600080fd5b5061033b67045c1df22dfdf00081565b34801561086e57600080fd5b5061088261087d36600461532b565b612a67565b6040516102cd959493929190615bfc565b34801561089f57600080fd5b506102eb6108ae3660046154b5565b612b37565b3480156108bf57600080fd5b506103696108ce3660046151ba565b613042565b3480156108df57600080fd5b506102eb6108ee36600461532b565b613084565b3480156108ff57600080fd5b50600f546102c19060ff1681565b34801561091957600080fd5b5061033b604081565b34801561092e57600080fd5b5061036961093d36600461532b565b613574565b34801561094e57600080fd5b5061033b61095d366004614f3d565b613685565b34801561096e57600080fd5b506102eb613724565b34801561098357600080fd5b506102c1610992366004614f5a565b613733565b3480156109a357600080fd5b506103187f000000000000000000000000000000000000000000000000000000000000000081565b3480156109d757600080fd5b5061033b600281565b3480156109ec57600080fd5b506103696109fb366004614f3d565b61376e565b6000610a0b8261380b565b92915050565b606060028054610a2090615e67565b80601f0160208091040260200160405190810160405280929190818152602001828054610a4c90615e67565b8015610a995780601f10610a6e57610100808354040283529160200191610a99565b820191906000526020600020905b815481529060010190602001808311610a7c57829003601f168201915b5050505050905090565b6000610aae82613830565b610b145760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600660205260409020546001600160a01b031690565b6000610b3b8261206b565b9050806001600160a01b0316836001600160a01b03161415610ba95760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610b0b565b336001600160a01b0382161480610bc55750610bc58133613733565b610c325760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776044820152771b995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b60421b6064820152608401610b0b565b610c3c838361384d565b505050565b600d5482908110610c645760405162461bcd60e51b8152600401610b0b90615ac1565b82600d8181548110610c7857610c78615f0d565b600091825260209091206004600790920201015460ff1615610cac5760405162461bcd60e51b8152600401610b0b90615bd5565b33610cb561263b565b6001600160a01b031614610cdb5760405162461bcd60e51b8152600401610b0b90615aef565b82600d8581548110610cef57610cef615f0d565b90600052602060002090600702016000019080519060200190610d13929190614cf6565b506040518490600080516020615fa583398151915290600090a250505050565b6060600082604051602001610d489190615784565b6040516020818303038152906040529050805161010014610d9c5760405162461bcd60e51b815260206004820152600e60248201526d323536206368617261637465727360901b6044820152606401610b0b565b6000600d610da986611ce8565b81548110610db957610db9615f0d565b90600052602060002090600702016040518061010001604052908160008201805480602002602001604051908101604052809291908181526020018280548015610e2257602002820191906000526020600020905b815481526020019060010190808311610e0e575b505050918352505060018201546020820152600282015463ffffffff8082166040840152600160201b909104166060820152600382018054608090920191610e6990615e67565b80601f0160208091040260200160405190810160405280929190818152602001828054610e9590615e67565b8015610ee25780601f10610eb757610100808354040283529160200191610ee2565b820191906000526020600020905b815481529060010190602001808311610ec557829003601f168201915b5050509183525050600482015460ff1615156020820152600582018054604090920191610f0e90615e67565b80601f0160208091040260200160405190810160405280929190818152602001828054610f3a90615e67565b8015610f875780601f10610f5c57610100808354040283529160200191610f87565b820191906000526020600020905b815481529060010190602001808311610f6a57829003601f168201915b50505050508152602001600682018054610fa090615e67565b80601f0160208091040260200160405190810160405280929190818152602001828054610fcc90615e67565b80156110195780601f10610fee57610100808354040283529160200191611019565b820191906000526020600020905b815481529060010190602001808311610ffc57829003601f168201915b50505050508152505090506000600182606001518360400151600161103e9190615d61565b6110489190615dbc565b6110529190615dff565b63ffffffff166001600160401b0381111561106f5761106f615f23565b6040519080825280601f01601f191660200182016040528015611099576020820181803683370190505b50905060006110a787611ef3565b905060008060005b83518110156111a657868482815181106110cb576110cb615f0d565b0160200151815160f89190911c9081106110e7576110e7615f0d565b602001015160f81c60f81b85838151811061110457611104615f0d565b60200101906001600160f81b031916908160001a9053508161112581615e9c565b925050828061113390615e9c565b935050856040015163ffffffff168314801561114f5750845182105b1561119457600a60f81b85838151811061116b5761116b615f0d565b60200101906001600160f81b031916908160001a9053508161118c81615e9c565b925050600092505b8061119e81615e9c565b9150506110af565b509298975050505050505050565b600d54839081106111d75760405162461bcd60e51b8152600401610b0b90615ac1565b83600d81815481106111eb576111eb615f0d565b600091825260209091206004600790920201015460ff161561121f5760405162461bcd60e51b8152600401610b0b90615bd5565b3361122861263b565b6001600160a01b03161461124e5760405162461bcd60e51b8152600401610b0b90615aef565b83600d868154811061126257611262615f0d565b906000526020600020906007020160020160006101000a81548163ffffffff021916908363ffffffff16021790555082600d86815481106112a5576112a5615f0d565b600091825260208220600260079092020101805463ffffffff93909316600160201b0263ffffffff60201b19909316929092179091556040518691600080516020615fa583398151915291a25050505050565b611303335b826138bb565b61131f5760405162461bcd60e51b8152600401610b0b90615b84565b610c3c83838361397d565b3361133361263b565b6001600160a01b0316146113595760405162461bcd60e51b8152600401610b0b90615aef565b600f805460ff19168215151790556040517f2e333d757ff21cd43147d6ff03380cc5abebbbb47cdd7a651f58c8980b4d994190600090a150565b600d54819081106113b65760405162461bcd60e51b8152600401610b0b90615ac1565b336113bf61263b565b6001600160a01b0316146113e55760405162461bcd60e51b8152600401610b0b90615aef565b6000600d83815481106113fa576113fa615f0d565b9060005260206000209060070201604051806101000160405290816000820180548060200260200160405190810160405280929190818152602001828054801561146357602002820191906000526020600020905b81548152602001906001019080831161144f575b505050918352505060018201546020820152600282015463ffffffff8082166040840152600160201b9091041660608201526003820180546080909201916114aa90615e67565b80601f01602080910402602001604051908101604052809291908181526020018280546114d690615e67565b80156115235780601f106114f857610100808354040283529160200191611523565b820191906000526020600020905b81548152906001019060200180831161150657829003601f168201915b5050509183525050600482015460ff161515602082015260058201805460409092019161154f90615e67565b80601f016020809104026020016040519081016040528092919081815260200182805461157b90615e67565b80156115c85780601f1061159d576101008083540402835291602001916115c8565b820191906000526020600020905b8154815290600101906020018083116115ab57829003601f168201915b505050505081526020016006820180546115e190615e67565b80601f016020809104026020016040519081016040528092919081815260200182805461160d90615e67565b801561165a5780601f1061162f5761010080835404028352916020019161165a565b820191906000526020600020905b81548152906001019060200180831161163d57829003601f168201915b5050505050815250509050600080600090505b825151811015611756577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630b50f5aa846000015183815181106116bc576116bc615f0d565b60200260200101516040518263ffffffff1660e01b81526004016116e291815260200190565b60006040518083038186803b1580156116fa57600080fd5b505afa15801561170e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526117369190810190615236565b51516117429083615d49565b91508061174e81615e9c565b91505061166d565b50808260600151836040015161176c9190615dbc565b63ffffffff16146117b45760405162461bcd60e51b8152602060048201526012602482015271496e76616c69642064696d656e73696f6e7360701b6044820152606401610b0b565b6001600d85815481106117c9576117c9615f0d565b60009182526020909120600790910201600401805460ff191691151591909117905550505050565b60006117fc83612243565b821061185e5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610b0b565b506001600160a01b03919091166000908152600860209081526040808320938352929052205490565b611892335b836138bb565b6118d75760405162461bcd60e51b815260206004820152601660248201527527b7363c9037bbb732b91037b91030b8383937bb32b960511b6044820152606401610b0b565b60006118e28361206b565b9050806001600160a01b0316826001600160a01b0316141561193e5760405162461bcd60e51b815260206004820152601560248201527420b8383937bb34b733903a37b5b2b71037bbb732b960591b6044820152606401610b0b565b6000838152600e60205260409081902060020180546001600160a01b0319166001600160a01b0385161790555183907f37d54eb27386ac5215a0df35ab1824dea2beac452cda1eecda9ec366807600a89061199a908590615924565b60405180910390a2505050565b6040516351cff8d960e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906351cff8d9906119f3908490600401615924565b600060405180830381600087803b158015611a0d57600080fd5b505af1158015611a21573d6000803e3d6000fd5b5050505050565b81611a32336112fd565b80611a5657506000818152600e60205260409020600201546001600160a01b031633145b611a725760405162461bcd60e51b8152600401610b0b90615b24565b815161030014611a945760405162461bcd60e51b8152600401610b0b90615b56565b6000838152600e602090815260409091208351611ab992600490920191850190614d41565b506000838152600e60205260408120805491611ad483615e9c565b9190505550611ae03390565b6000848152600e60205260408082206001810180546001600160a01b0319166001600160a01b039590951694909417909355600390920180546001600160c01b031916905590518491600080516020615f6583398151915291a2505050565b600d5481908110611b625760405162461bcd60e51b8152600401610b0b90615ac1565b33611b6b61263b565b6001600160a01b031614611b915760405162461bcd60e51b8152600401610b0b90615aef565b6002600d8381548110611ba657611ba6615f0d565b90600052602060002090600702016001015410611bf75760405162461bcd60e51b815260206004820152600f60248201526e446f6e27742062652067726565647960881b6044820152606401610b0b565b611c0082613b16565b5050565b600d5482908110611c275760405162461bcd60e51b8152600401610b0b90615ac1565b33611c3061263b565b6001600160a01b031614611c565760405162461bcd60e51b8152600401610b0b90615aef565b81600d8481548110611c6a57611c6a615f0d565b90600052602060002090600702016006019080519060200190611c8e929190614d41565b50505050565b33611c9d61263b565b6001600160a01b031614611cc35760405162461bcd60e51b8152600401610b0b90615aef565b611ccb613feb565b565b610c3c83838360405180602001604052806000815250612a36565b6000610a0b61271083615d89565b600d8181548110611d0657600080fd5b600091825260209091206007909102016001810154600282015460038301805492945063ffffffff80831694600160201b9093041692611d4590615e67565b80601f0160208091040260200160405190810160405280929190818152602001828054611d7190615e67565b8015611dbe5780601f10611d9357610100808354040283529160200191611dbe565b820191906000526020600020905b815481529060010190602001808311611da157829003601f168201915b5050506004840154600585018054949560ff909216949193509150611de290615e67565b80601f0160208091040260200160405190810160405280929190818152602001828054611e0e90615e67565b8015611e5b5780601f10611e3057610100808354040283529160200191611e5b565b820191906000526020600020905b815481529060010190602001808311611e3e57829003601f168201915b505050505090806006018054611e7090615e67565b80601f0160208091040260200160405190810160405280929190818152602001828054611e9c90615e67565b8015611ee95780601f10611ebe57610100808354040283529160200191611ee9565b820191906000526020600020905b815481529060010190602001808311611ecc57829003601f168201915b5050505050905087565b6060611efe82613830565b611f1a5760405162461bcd60e51b8152600401610b0b90615a42565b610a0b6107ab83611ce8565b6000611f31600a5490565b8210611f945760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610b0b565b600a8281548110611fa757611fa7615f0d565b90600052602060002001549050919050565b6001546000906001600160a01b031680158015906120635750826001600160a01b0316816001600160a01b031663c4552791866040518263ffffffff1660e01b81526004016120089190615924565b60206040518083038186803b15801561202057600080fd5b505afa158015612034573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612058919061519d565b6001600160a01b0316145b949350505050565b6000818152600460205260408120546001600160a01b031680610a0b5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610b0b565b67045c1df22dfdf0003410156121315760405162461bcd60e51b8152602060048201526014602482015273125b9cdd59999a58da595b9d081c185e5b595b9d60621b6044820152606401610b0b565b61214261213c61263b565b34614078565b600d546000813360115460405160609290921b6001600160601b031916602083015242603483015260548201526074016040516020818303038152906040528051906020012060001c6121959190615eb7565b905060005b82811015612204576000836121af8385615d49565b6121b99190615eb7565b90506040600d82815481106121d0576121d0615f0d565b90600052602060002090600702016001015410156121f157611c8e81613b16565b50806121fc81615e9c565b91505061219a565b5060405162461bcd60e51b8152602060048201526013602482015272105b1b081cd95c9a595cc81cdbdb19081bdd5d606a1b6044820152606401610b0b565b60006001600160a01b0382166122ae5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610b0b565b506001600160a01b031660009081526005602052604090205490565b336122d361263b565b6001600160a01b0316146122f95760405162461bcd60e51b8152600401610b0b90615aef565b611ccb60006140fc565b6000610a0b61271083615eb7565b3361231a61263b565b6001600160a01b0316146123405760405162461bcd60e51b8152600401610b0b90615aef565b611ccb614156565b3361235161263b565b6001600160a01b0316146123775760405162461bcd60e51b8152600401610b0b90615aef565b600d5486146123c05760405162461bcd60e51b8152602060048201526015602482015274125b9d985b1a59081b995dc81cd95c9a595cc81251605a1b6044820152606401610b0b565b600d604051806101000160405280858152602001600081526020018463ffffffff1681526020018363ffffffff16815260200160006001600160401b0381111561240c5761240c615f23565b6040519080825280601f01601f191660200182016040528015612436576020820181803683370190505b50815260006020808301829052604083018a9052606090920188905283546001810185559381528190208251805193946007029091019261247a9284920190614cf6565b5060208281015160018301556040830151600283018054606086015163ffffffff908116600160201b026001600160401b0319909216931692909217919091179055608083015180516124d39260038501920190614d41565b5060a082015160048201805460ff191691151591909117905560c08201518051612507916005840191602090910190614d41565b5060e08201518051612523916006840191602090910190614d41565b5050604051879150600080516020615fa583398151915290600090a2505050505050565b600d548290811061256a5760405162461bcd60e51b8152600401610b0b90615ac1565b82600d818154811061257e5761257e615f0d565b600091825260209091206004600790920201015460ff16156125b25760405162461bcd60e51b8152600401610b0b90615bd5565b336125bb61263b565b6001600160a01b0316146125e15760405162461bcd60e51b8152600401610b0b90615aef565b8251610300146126035760405162461bcd60e51b8152600401610b0b90615b56565b82600d858154811061261757612617615f0d565b90600052602060002090600702016003019080519060200190611a21929190614d41565b600c5461010090046001600160a01b031690565b3361265861263b565b6001600160a01b03161461267e5760405162461bcd60e51b8152600401610b0b90615aef565b612687816141d1565b50565b60607f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316639f6aaa926126c58585612b37565b6040518263ffffffff1660e01b81526004016126e191906159b2565b60006040518083038186803b1580156126f957600080fd5b505afa15801561270d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261273591908101906151ee565b9392505050565b606060038054610a2090615e67565b6001600160a01b0382163314156127a05760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b6044820152606401610b0b565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b600d54606090829081106128325760405162461bcd60e51b8152600401610b0b90615ac1565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630b6093d1600d858154811061287457612874615f0d565b90600052602060002090600702016000016040518263ffffffff1660e01b81526004016128a1919061596b565b60006040518083038186803b1580156128b957600080fd5b505afa1580156128cd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526128f59190810190615169565b91505b50919050565b3361290761263b565b6001600160a01b03161461292d5760405162461bcd60e51b8152600401610b0b90615aef565b60005b81811015610c3c5782828281811061294a5761294a615f0d565b905060400201602001356010600085858581811061296a5761296a615f0d565b6129809260206040909202019081019150614f3d565b6001600160a01b03168152602081019190915260400160002055806129a481615e9c565b915050612930565b600d54829081106129cf5760405162461bcd60e51b8152600401610b0b90615ac1565b336129d861263b565b6001600160a01b0316146129fe5760405162461bcd60e51b8152600401610b0b90615aef565b81600d8481548110612a1257612a12615f0d565b90600052602060002090600702016005019080519060200190611c8e929190614d41565b612a3f3361188c565b612a5b5760405162461bcd60e51b8152600401610b0b90615b84565b611c8e848484846141e4565b600e602052600090815260409020805460018201546002830154600384015460048501805494956001600160a01b039485169593909416936001600160c01b0390921692612ab490615e67565b80601f0160208091040260200160405190810160405280929190818152602001828054612ae090615e67565b8015612b2d5780601f10612b0257610100808354040283529160200191612b2d565b820191906000526020600020905b815481529060010190602001808311612b1057829003601f168201915b5050505050905085565b6060612b4283613830565b612b5e5760405162461bcd60e51b8152600401610b0b90615a42565b6000600d612b6b85611ce8565b81548110612b7b57612b7b615f0d565b90600052602060002090600702016040518061010001604052908160008201805480602002602001604051908101604052809291908181526020018280548015612be457602002820191906000526020600020905b815481526020019060010190808311612bd0575b505050918352505060018201546020820152600282015463ffffffff8082166040840152600160201b909104166060820152600382018054608090920191612c2b90615e67565b80601f0160208091040260200160405190810160405280929190818152602001828054612c5790615e67565b8015612ca45780601f10612c7957610100808354040283529160200191612ca4565b820191906000526020600020905b815481529060010190602001808311612c8757829003601f168201915b5050509183525050600482015460ff1615156020820152600582018054604090920191612cd090615e67565b80601f0160208091040260200160405190810160405280929190818152602001828054612cfc90615e67565b8015612d495780601f10612d1e57610100808354040283529160200191612d49565b820191906000526020600020905b815481529060010190602001808311612d2c57829003601f168201915b50505050508152602001600682018054612d6290615e67565b80601f0160208091040260200160405190810160405280929190818152602001828054612d8e90615e67565b8015612ddb5780601f10612db057610100808354040283529160200191612ddb565b820191906000526020600020905b815481529060010190602001808311612dbe57829003601f168201915b50505050508152505090506000612df185614217565b5090506000612dff86611ef3565b905060018563ffffffff161115612f8b577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663e4c4ed997f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663acb261b584876040015188606001518b6040518563ffffffff1660e01b8152600401612e999493929190615a09565b60006040518083038186803b158015612eb157600080fd5b505afa158015612ec5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612eed9190810190615169565b878660400151612efd9190615dbc565b888760600151612f0d9190615dbc565b866040518563ffffffff1660e01b8152600401612f2d94939291906159c5565b60006040518083038186803b158015612f4557600080fd5b505afa158015612f59573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612f819190810190615169565b9350505050610a0b565b6040808401516060850151915163e4c4ed9960e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169263e4c4ed9992612fe49286929088906004016159c5565b60006040518083038186803b158015612ffc57600080fd5b505afa158015613010573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526130389190810190615169565b9695505050505050565b3361304b61263b565b6001600160a01b0316146130715760405162461bcd60e51b8152600401610b0b90615aef565b8051611c00906012906020840190614d41565b6000818152600e60209081526040808320815160a0810183528154815260018201546001600160a01b039081169482019490945260028201549093169183019190915260038101546001600160c01b031660608381019190915260048201805491949392916080840191906130f890615e67565b80601f016020809104026020016040519081016040528092919081815260200182805461312490615e67565b80156131715780601f1061314657610100808354040283529160200191613171565b820191906000526020600020905b81548152906001019060200180831161315457829003601f168201915b50505050508152505090506000600d61318985611ce8565b8154811061319957613199615f0d565b9060005260206000209060070201604051806101000160405290816000820180548060200260200160405190810160405280929190818152602001828054801561320257602002820191906000526020600020905b8154815260200190600101908083116131ee575b505050918352505060018201546020820152600282015463ffffffff8082166040840152600160201b90910416606082015260038201805460809092019161324990615e67565b80601f016020809104026020016040519081016040528092919081815260200182805461327590615e67565b80156132c25780601f10613297576101008083540402835291602001916132c2565b820191906000526020600020905b8154815290600101906020018083116132a557829003601f168201915b5050509183525050600482015460ff16151560208201526005820180546040909201916132ee90615e67565b80601f016020809104026020016040519081016040528092919081815260200182805461331a90615e67565b80156133675780601f1061333c57610100808354040283529160200191613367565b820191906000526020600020905b81548152906001019060200180831161334a57829003601f168201915b5050505050815260200160068201805461338090615e67565b80601f01602080910402602001604051908101604052809291908181526020018280546133ac90615e67565b80156133f95780601f106133ce576101008083540402835291602001916133f9565b820191906000526020600020905b8154815290600101906020018083116133dc57829003601f168201915b5050505050815250509050600061340f85612303565b905060008260c00151613421836144a4565b8460e0015160126134318a6144a4565b6040516020016134459594939291906157a0565b6040516020818303038152906040529050808360c0015161346986600001516144a4565b60405160200161347b93929190615604565b60408051601f1981840301815291905260208501519091506001600160a01b0316156134dd57806134ba85602001516001600160a01b031660146145a1565b6040516020016134cb9291906156fa565b60405160208183030381529060405290505b60006134e887614217565b91505080156135145781604051602001613502919061555c565b60405160208183030381529060405291505b8261353c578160405160200161352a91906156c2565b60405160208183030381529060405291505b8161354888600161268a565b60405160200161355992919061559d565b60405160208183030381529060405295505050505050919050565b8061357e336112fd565b806135a257506000818152600e60205260409020600201546001600160a01b031633145b6135be5760405162461bcd60e51b8152600401610b0b90615b24565b6000828152600e60205260409020600301546001600160c01b0316156136165760405162461bcd60e51b815260206004820152600d60248201526c105b1c9958591e481c995cd95d609a1b6044820152606401610b0b565b6000828152600e6020526040812080549161363083615e9c565b90915550506000828152600e6020526040808220600180820180546001600160a01b0319169055600390910180546001600160c01b0319169091179055518391600080516020615f6583398151915291a25050565b6040516371d4ed8d60e11b81526000906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063e3a9db1a906136d4908590600401615924565b60206040518083038186803b1580156136ec57600080fd5b505afa158015613700573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0b9190615344565b606060008054610a2090615e67565b6001600160a01b03808316600090815260076020908152604080832093851683529290529081205460ff168061273557506127358383611fb9565b3361377761263b565b6001600160a01b03161461379d5760405162461bcd60e51b8152600401610b0b90615aef565b6001600160a01b0381166138025760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610b0b565b612687816140fc565b60006001600160e01b0319821663780e9d6360e01b1480610a0b5750610a0b8261473c565b6000908152600460205260409020546001600160a01b0316151590565b600081815260066020526040902080546001600160a01b0319166001600160a01b03841690811790915581906138828261206b565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60006138c682613830565b6139275760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610b0b565b60006139328361206b565b9050806001600160a01b0316846001600160a01b0316148061396d5750836001600160a01b031661396284610aa3565b6001600160a01b0316145b8061206357506120638185613733565b826001600160a01b03166139908261206b565b6001600160a01b0316146139f85760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610b0b565b6001600160a01b038216613a5a5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610b0b565b613a6583838361478c565b613a7060008261384d565b6001600160a01b0383166000908152600560205260408120805460019290613a99908490615de8565b90915550506001600160a01b0382166000908152600560205260408120805460019290613ac7908490615d49565b909155505060008181526004602052604080822080546001600160a01b0319166001600160a01b038681169182179092559151849391871691600080516020615f8583398151915291a4505050565b600d5481908110613b395760405162461bcd60e51b8152600401610b0b90615ac1565b613b4161263b565b6001600160a01b0316336001600160a01b031614613c2857600f5460ff1615613bda573360008181526010602052604090205490613b7e90612243565b10613bd55760405162461bcd60e51b815260206004820152602160248201527f4561726c79206163636573732065786861757374656420666f722077616c6c656044820152601d60fa1b6064820152608401610b0b565b613c28565b600d54613be633612243565b10613c285760405162461bcd60e51b815260206004820152601260248201527115d85b1b195d0818d85c081c995858da195960721b6044820152606401610b0b565b6000600d8381548110613c3d57613c3d615f0d565b90600052602060002090600702016040518061010001604052908160008201805480602002602001604051908101604052809291908181526020018280548015613ca657602002820191906000526020600020905b815481526020019060010190808311613c92575b505050918352505060018201546020820152600282015463ffffffff8082166040840152600160201b909104166060820152600382018054608090920191613ced90615e67565b80601f0160208091040260200160405190810160405280929190818152602001828054613d1990615e67565b8015613d665780601f10613d3b57610100808354040283529160200191613d66565b820191906000526020600020905b815481529060010190602001808311613d4957829003601f168201915b5050509183525050600482015460ff1615156020820152600582018054604090920191613d9290615e67565b80601f0160208091040260200160405190810160405280929190818152602001828054613dbe90615e67565b8015613e0b5780601f10613de057610100808354040283529160200191613e0b565b820191906000526020600020905b815481529060010190602001808311613dee57829003601f168201915b50505050508152602001600682018054613e2490615e67565b80601f0160208091040260200160405190810160405280929190818152602001828054613e5090615e67565b8015613e9d5780601f10613e7257610100808354040283529160200191613e9d565b820191906000526020600020905b815481529060010190602001808311613e8057829003601f168201915b50505050508152505090506000816020015161271085613ebd9190615d9d565b613ec79190615d49565b60118190556040805160a08101825260008082526020808301828152838501838152606085018481528651858152808501885260808701908152888652600e8552969094208551815591516001830180546001600160a01b03199081166001600160a01b03938416179091559151600284018054909316911617905591516003830180546001600160c01b0319166001600160c01b039092169190911790559251805194955091939092613f82926004850192910190614d41565b50905050600d8481548110613f9957613f99615f0d565b600091825260208220600160079092020101805491613fb783615e9c565b9190505550613fcc613fc63390565b826147b6565b6040518190600080516020615f6583398151915290600090a250505050565b600c5460ff166140345760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610b0b565b600c805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405161406e9190615924565b60405180910390a1565b60405163f340fa0160e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063f340fa019083906140c6908690600401615924565b6000604051808303818588803b1580156140df57600080fd5b505af11580156140f3573d6000803e3d6000fd5b50505050505050565b600c80546001600160a01b03838116610100818102610100600160a81b031985161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600c5460ff161561419c5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610b0b565b600c805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586140613390565b8051611c00906000906020840190614d41565b6141ef84848461397d565b6141fb848484846147d0565b611c8e5760405162461bcd60e51b8152600401610b0b90615a6f565b6000818152600e60209081526040808320815160a0810183528154815260018201546001600160a01b039081169482019490945260028201549093169183019190915260038101546001600160c01b0316606083810191909152600482018054919493849390929091608084019161428e90615e67565b80601f01602080910402602001604051908101604052809291908181526020018280546142ba90615e67565b80156143075780601f106142dc57610100808354040283529160200191614307565b820191906000526020600020905b8154815290600101906020018083116142ea57829003601f168201915b5050505050815250509050600081608001519050600082606001516001600160c01b03166001148061433857508151155b9050801561449957600d61434b87611ce8565b8154811061435b5761435b615f0d565b9060005260206000209060070201600301805461437790615e67565b80601f01602080910402602001604051908101604052809291908181526020018280546143a390615e67565b80156143f05780601f106143c5576101008083540402835291602001916143f0565b820191906000526020600020905b8154815290600101906020018083116143d357829003601f168201915b50505050509150815160001415614499577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316631abe81a16040518163ffffffff1660e01b815260040160006040518083038186803b15801561445a57600080fd5b505afa15801561446e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526144969190810190615169565b91505b909590945092505050565b6060816144c85750506040805180820190915260018152600360fc1b602082015290565b8160005b81156144f257806144dc81615e9c565b91506144eb9050600a83615d89565b91506144cc565b6000816001600160401b0381111561450c5761450c615f23565b6040519080825280601f01601f191660200182016040528015614536576020820181803683370190505b5090505b84156120635761454b600183615de8565b9150614558600a86615eb7565b614563906030615d49565b60f81b81838151811061457857614578615f0d565b60200101906001600160f81b031916908160001a90535061459a600a86615d89565b945061453a565b606060006145b0836002615d9d565b6145bb906002615d49565b6001600160401b038111156145d2576145d2615f23565b6040519080825280601f01601f1916602001820160405280156145fc576020820181803683370190505b509050600360fc1b8160008151811061461757614617615f0d565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061464657614646615f0d565b60200101906001600160f81b031916908160001a905350600061466a846002615d9d565b614675906001615d49565b90505b60018111156146ed576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106146a9576146a9615f0d565b1a60f81b8282815181106146bf576146bf615f0d565b60200101906001600160f81b031916908160001a90535060049490941c936146e681615e50565b9050614678565b5083156127355760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610b0b565b60006001600160e01b031982166380ac58cd60e01b148061476d57506001600160e01b03198216635b5e139f60e01b145b80610a0b57506301ffc9a760e01b6001600160e01b0319831614610a0b565b6000818152600e6020526040902060020180546001600160a01b0319169055610c3c8383836148dd565b611c0082826040518060200160405280600081525061494f565b60006001600160a01b0384163b156148d257604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290614814903390899088908890600401615938565b602060405180830381600087803b15801561482e57600080fd5b505af192505050801561485e575060408051601f3d908101601f1916820190925261485b9181019061514c565b60015b6148b8573d80801561488c576040519150601f19603f3d011682016040523d82523d6000602084013e614891565b606091505b5080516148b05760405162461bcd60e51b8152600401610b0b90615a6f565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612063565b506001949350505050565b6148e8838383614982565b600c5460ff1615610c3c5760405162461bcd60e51b815260206004820152602b60248201527f4552433732315061757361626c653a20746f6b656e207472616e73666572207760448201526a1a1a5b19481c185d5cd95960aa1b6064820152608401610b0b565b6149598383614a3a565b61496660008484846147d0565b610c3c5760405162461bcd60e51b8152600401610b0b90615a6f565b6001600160a01b0383166149dd576149d881600a80546000838152600b60205260408120829055600182018355919091527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80155565b614a00565b816001600160a01b0316836001600160a01b031614614a0057614a008382614b66565b6001600160a01b038216614a1757610c3c81614c03565b826001600160a01b0316826001600160a01b031614610c3c57610c3c8282614cb2565b6001600160a01b038216614a905760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610b0b565b614a9981613830565b15614ae55760405162461bcd60e51b815260206004820152601c60248201527b115490cdcc8c4e881d1bdad95b88185b1c9958591e481b5a5b9d195960221b6044820152606401610b0b565b614af16000838361478c565b6001600160a01b0382166000908152600560205260408120805460019290614b1a908490615d49565b909155505060008181526004602052604080822080546001600160a01b0319166001600160a01b0386169081179091559051839290600080516020615f85833981519152908290a45050565b60006001614b7384612243565b614b7d9190615de8565b600083815260096020526040902054909150808214614bd0576001600160a01b03841660009081526008602090815260408083208584528252808320548484528184208190558352600990915290208190555b5060009182526009602090815260408084208490556001600160a01b039094168352600881528383209183525290812055565b600a54600090614c1590600190615de8565b6000838152600b6020526040812054600a8054939450909284908110614c3d57614c3d615f0d565b9060005260206000200154905080600a8381548110614c5e57614c5e615f0d565b6000918252602080832090910192909255828152600b9091526040808220849055858252812055600a805480614c9657614c96615ef7565b6001900381819060005260206000200160009055905550505050565b6000614cbd83612243565b6001600160a01b039093166000908152600860209081526040808320868452825280832085905593825260099052919091209190915550565b828054828255906000526020600020908101928215614d31579160200282015b82811115614d31578251825591602001919060010190614d16565b50614d3d929150614db4565b5090565b828054614d4d90615e67565b90600052602060002090601f016020900481019282614d6f5760008555614d31565b82601f10614d8857805160ff1916838001178555614d31565b82800160010185558215614d315791820182811115614d31578251825591602001919060010190614d16565b5b80821115614d3d5760008155600101614db5565b6000614ddc614dd784615d22565b615cf2565b9050828152838383011115614df057600080fd5b612735836020830184615e24565b600082601f830112614e0f57600080fd5b813560206001600160401b03821115614e2a57614e2a615f23565b8160051b614e39828201615cf2565b838152828101908684018388018501891015614e5457600080fd5b600093505b85841015614e77578035835260019390930192918401918401614e59565b50979650505050505050565b80358015158114614e9357600080fd5b919050565b600082601f830112614ea957600080fd5b8135614eb7614dd782615d22565b818152846020838601011115614ecc57600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f830112614efa57600080fd5b61273583835160208501614dc9565b805160058110614e9357600080fd5b803563ffffffff81168114614e9357600080fd5b805160ff81168114614e9357600080fd5b600060208284031215614f4f57600080fd5b813561273581615f39565b60008060408385031215614f6d57600080fd5b8235614f7881615f39565b91506020830135614f8881615f39565b809150509250929050565b600080600060608486031215614fa857600080fd5b8335614fb381615f39565b92506020840135614fc381615f39565b929592945050506040919091013590565b60008060008060808587031215614fea57600080fd5b8435614ff581615f39565b9350602085013561500581615f39565b92506040850135915060608501356001600160401b0381111561502757600080fd5b61503387828801614e98565b91505092959194509250565b6000806040838503121561505257600080fd5b823561505d81615f39565b915061506b60208401614e83565b90509250929050565b6000806040838503121561508757600080fd5b823561509281615f39565b946020939093013593505050565b600080602083850312156150b357600080fd5b82356001600160401b03808211156150ca57600080fd5b818501915085601f8301126150de57600080fd5b8135818111156150ed57600080fd5b8660208260061b850101111561510257600080fd5b60209290920196919550909350505050565b60006020828403121561512657600080fd5b61273582614e83565b60006020828403121561514157600080fd5b813561273581615f4e565b60006020828403121561515e57600080fd5b815161273581615f4e565b60006020828403121561517b57600080fd5b81516001600160401b0381111561519157600080fd5b61206384828501614ee9565b6000602082840312156151af57600080fd5b815161273581615f39565b6000602082840312156151cc57600080fd5b81356001600160401b038111156151e257600080fd5b61206384828501614e98565b60006020828403121561520057600080fd5b81516001600160401b0381111561521657600080fd5b8201601f8101841361522757600080fd5b61206384825160208401614dc9565b60006020828403121561524857600080fd5b81516001600160401b038082111561525f57600080fd5b9083019081850361010081121561527557600080fd5b61527d615ca8565b83518381111561528c57600080fd5b61529888828701614ee9565b82525060e0601f19830112156152ad57600080fd5b6152b5615cd0565b92506020840151835260408401516020840152606084015160408401526080840151606084015260a084015191508160010b82146152f257600080fd5b81608084015261530460c08501614f2c565b60a084015261531560e08501614f09565b60c0840152602081019290925250949350505050565b60006020828403121561533d57600080fd5b5035919050565b60006020828403121561535657600080fd5b5051919050565b6000806040838503121561537057600080fd5b823591506020830135614f8881615f39565b6000806040838503121561539557600080fd5b8235915060208301356001600160401b038111156153b257600080fd5b6153be85828601614dfe565b9150509250929050565b600080604083850312156153db57600080fd5b8235915060208301356001600160401b038111156153f857600080fd5b6153be85828601614e98565b60008060008060008060c0878903121561541d57600080fd5b8635955060208701356001600160401b038082111561543b57600080fd5b6154478a838b01614e98565b9650604089013591508082111561545d57600080fd5b6154698a838b01614e98565b9550606089013591508082111561547f57600080fd5b5061548c89828a01614dfe565b93505061549b60808801614f18565b91506154a960a08801614f18565b90509295509295509295565b600080604083850312156154c857600080fd5b8235915061506b60208401614f18565b6000806000606084860312156154ed57600080fd5b833592506154fd60208501614f18565b915061550b60408501614f18565b90509250925092565b6000815180845261552c816020860160208601615e24565b601f01601f19169290920160200192915050565b60008151615552818560208601615e24565b9290920192915050565b6000825161556e818460208701615e24565b7f2c7b2276616c7565223a224f726967696e616c2050616c65747465227d000000920191825250601d01919050565b600083516155af818460208801615e24565b61174b60f21b908301908152681134b6b0b3b2911d1160b91b600282015283516155e081600b840160208801615e24565b601160f91b600b9290910191820152607d60f81b600c820152600d01949350505050565b60008451615616818460208901615e24565b771130ba3a3934b13aba32b9911d2dbd913b30b63ab2911d1160411b908301908152845161564b816018840160208901615e24565b63227d2c7b60e01b601892909101918201527f2274726169745f74797065223a2250616c65747465204368616e676573222c00601c82015267113b30b63ab2911d60c11b603b82015283516156a7816043840160208801615e24565b607d60f81b6043929091019182015260440195945050505050565b600082516156d4818460208701615e24565b732c7b2276616c7565223a2247656e65736973227d60601b920191825250601401919050565b6000835161570c818460208801615e24565b612c7b60f01b90830190815279089d1c985a5d17dd1e5c19488e8894185b195d1d1948109e488b60321b600282015268113b30b63ab2911d1160b91b601c8201528351615760816025840160208801615e24565b601160f91b60259290910191820152607d60f81b6026820152602701949350505050565b60008251615796818460208701615e24565b9190910192915050565b76646174613a6170706c69636174696f6e2f6a736f6e2c7b60481b815267113730b6b2911d1160c11b6017820152855160009060206157e582601f8601838c01615e24565b61202360f01b601f9285019283015287516158068160218501848c01615e24565b61088b60f21b602193909101928301526e113232b9b1b934b83a34b7b7111d1160891b602383015286516158408160328501848b01615e24565b7111161132bc3a32b93730b62fbab936111d1160711b603293909101928301528554604490600090600181811c908083168061587d57607f831692505b86831081141561589b57634e487b7160e01b85526022600452602485fd5b8080156158af57600181146158c4576158f5565b60ff19851689880152838901870195506158f5565b60008d81526020902060005b858110156158eb5781548b82018a01529084019089016158d0565b505086848a010195505b50505050506159156159078289615540565b61088b60f21b815260020190565b9b9a5050505050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061303890830184615514565b6020808252825482820181905260008481528281209092916040850190845b818110156159a65783548352600193840193928501920161598a565b50909695505050505050565b6020815260006127356020830184615514565b6080815260006159d86080830187615514565b63ffffffff86811660208501528516604084015282810360608401526159fe8185615514565b979650505050505050565b608081526000615a1c6080830187615514565b63ffffffff95861660208401529385166040830152509216606090920191909152919050565b602080825260139082015272151bdad95b88191bd95cdb89dd08195e1a5cdd606a1b604082015260600190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526014908201527314d95c9a595cc8191bd95cdb89dd08195e1a5cdd60621b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601890820152774e6f7420617070726f76656420666f722070616c6574746560401b604082015260600190565b6020808252601490820152730c8d4d8818dbdb1bdd5c9cc81c995c5d5a5c995960621b604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252600d908201526c14d95c9a595cc81b1bd8dad959609a1b604082015260600190565b8581526001600160a01b038581166020830152841660408201526001600160c01b038316606082015260a0608082018190526000906159fe90830184615514565b878152600063ffffffff808916602084015280881660408401525060e06060830152615c6c60e0830187615514565b851515608084015282810360a0840152615c868186615514565b905082810360c0840152615c9a8185615514565b9a9950505050505050505050565b604080519081016001600160401b0381118282101715615cca57615cca615f23565b60405290565b60405160e081016001600160401b0381118282101715615cca57615cca615f23565b604051601f8201601f191681016001600160401b0381118282101715615d1a57615d1a615f23565b604052919050565b60006001600160401b03821115615d3b57615d3b615f23565b50601f01601f191660200190565b60008219821115615d5c57615d5c615ecb565b500190565b600063ffffffff808316818516808303821115615d8057615d80615ecb565b01949350505050565b600082615d9857615d98615ee1565b500490565b6000816000190483118215151615615db757615db7615ecb565b500290565b600063ffffffff80831681851681830481118215151615615ddf57615ddf615ecb565b02949350505050565b600082821015615dfa57615dfa615ecb565b500390565b600063ffffffff83811690831681811015615e1c57615e1c615ecb565b039392505050565b60005b83811015615e3f578181015183820152602001615e27565b83811115611c8e5750506000910152565b600081615e5f57615e5f615ecb565b506000190190565b600181811c90821680615e7b57607f821691505b602082108114156128f857634e487b7160e01b600052602260045260246000fd5b6000600019821415615eb057615eb0615ecb565b5060010190565b600082615ec657615ec6615ee1565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461268757600080fd5b6001600160e01b03198116811461268757600080fdfe76022b77c5b8d574c916a2ccc9ca03ca662f103473c0259a685c631922a1c706ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef75d0bf101ba113aff2a04b66a97ecc5b3658d8e6b47247d625c675f64a8acc29a2646970667358221220a7db30d08c6a67982bbb27fa7b5fb98aba6781e984d368077fada743f1f385f064736f6c63430008070033608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6105998061007e6000396000f3fe6080604052600436106100555760003560e01c806351cff8d91461005a578063715018a61461007c5780638da5cb5b14610091578063e3a9db1a146100c3578063f2fde38b14610107578063f340fa0114610127575b600080fd5b34801561006657600080fd5b5061007a6100753660046104cf565b61013a565b005b34801561008857600080fd5b5061007a6101e1565b34801561009d57600080fd5b506100a661021c565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156100cf57600080fd5b506100f96100de3660046104cf565b6001600160a01b031660009081526001602052604090205490565b6040519081526020016100ba565b34801561011357600080fd5b5061007a6101223660046104cf565b61022b565b61007a6101353660046104cf565b6102cb565b3361014361021c565b6001600160a01b0316146101725760405162461bcd60e51b8152600401610169906104f3565b60405180910390fd5b6001600160a01b038116600081815260016020526040812080549190559061019a9082610364565b816001600160a01b03167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5826040516101d591815260200190565b60405180910390a25050565b336101ea61021c565b6001600160a01b0316146102105760405162461bcd60e51b8152600401610169906104f3565b61021a600061047f565b565b6000546001600160a01b031690565b3361023461021c565b6001600160a01b03161461025a5760405162461bcd60e51b8152600401610169906104f3565b6001600160a01b0381166102bf5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610169565b6102c88161047f565b50565b336102d461021c565b6001600160a01b0316146102fa5760405162461bcd60e51b8152600401610169906104f3565b6001600160a01b038116600090815260016020526040812080543492839291610324908490610528565b90915550506040518181526001600160a01b038316907f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4906020016101d5565b804710156103b45760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610169565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610401576040519150601f19603f3d011682016040523d82523d6000602084013e610406565b606091505b505090508061047a5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c20726044820152791958da5c1a595b9d081b585e481a185d99481c995d995c9d195960321b6064820152608401610169565b505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156104e157600080fd5b81356104ec8161054e565b9392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000821982111561054957634e487b7160e01b600052601160045260246000fd5b500190565b6001600160a01b03811681146102c857600080fdfea264697066735822122014a2e1e2ec2b24ca99f9ab0bdc9609e1d2334d9e3de4a19404fbaf12c87250a464736f6c63430008070033608060405234801561001057600080fd5b50610e48806100206000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80631abe81a1146100515780639f6aaa921461006f578063acb261b514610082578063e4c4ed9914610095575b600080fd5b6100596100a8565b6040516100669190610bf5565b60405180910390f35b61005961007d366004610a2e565b6101a9565b610059610090366004610aee565b6101da565b6100596100a3366004610a6a565b6103bc565b6040805161030080825261032082019092526060916000919060208201818036833701905050905060008060005b6103008161ffff1610156101a0578260f81b915081848261ffff168151811061010157610101610da6565b60200101906001600160f81b031916908160001a9053508184610125836001610c3b565b61ffff168151811061013957610139610da6565b60200101906001600160f81b031916908160001a905350818461015d836002610c3b565b61ffff168151811061017157610171610da6565b60200101906001600160f81b031916908160001a905350600190920191610199600382610c3b565b90506100d6565b50919392505050565b60606101b482610822565b6040516020016101c49190610bb7565b6040516020818303038152906040529050919050565b83516060906101e98486610cd0565b63ffffffff16146102155760405162461bcd60e51b815260040161020c90610c0f565b60405180910390fd5b60008263ffffffff168363ffffffff1687516102319190610cb1565b61023b9190610cb1565b6001600160401b0381111561025257610252610dbc565b6040519080825280601f01601f19166020018201604052801561027c576020820181803683370190505b50905060008060005b8663ffffffff168163ffffffff1610156103af5760005b8663ffffffff168163ffffffff1610156103905760005b8963ffffffff168163ffffffff1610156103715760005b8863ffffffff168163ffffffff161015610350578b8663ffffffff16815181106102f6576102f6610da6565b602001015160f81c60f81b878663ffffffff168151811061031957610319610da6565b60200101906001600160f81b031916908160001a9053508461033a81610d6c565b955050808061034890610d6c565b9150506102ca565b508461035b81610d6c565b955050808061036990610d6c565b9150506102b3565b5061037c8985610cfc565b93508061038881610d6c565b91505061029c565b5061039b8884610c70565b9250806103a781610d6c565b915050610285565b5091979650505050505050565b83516060906103cb8486610cd0565b63ffffffff16146103ee5760405162461bcd60e51b815260040161020c90610c0f565b8151610300146104375760405162461bcd60e51b81526020600482015260146024820152730c8d4d8818dbdb1bdd5c9cc81c995c5d5a5c995960621b604482015260640161020c565b604080516104368082526104608201909252600091602082018180368337019050509050604260f81b8160008151811061047357610473610da6565b60200101906001600160f81b031916908160001a905350604d60f81b816001815181106104a2576104a2610da6565b60200101906001600160f81b031916908160001a905350600086516104366104ca9190610c70565b9050600060025b60068110156105255760ff831691508260081c92508160f81b8482815181106104fc576104fc610da6565b60200101906001600160f81b031916908160001a9053508061051d81610d51565b9150506104d1565b50603660f81b83600a8151811061053e5761053e610da6565b60200101906001600160f81b031916908160001a905350600460f81b83600b8151811061056d5761056d610da6565b60200101906001600160f81b031916908160001a905350602860f81b83600e8151811061059c5761059c610da6565b60200101906001600160f81b031916908160001a90535060125b601681101561060a5760ff881691508760081c97508160f81b8482815181106105e1576105e1610da6565b60200101906001600160f81b031916908160001a9053508061060281610d51565b9150506105b6565b5060165b601a8110156106625760ff871691508660081c96508160f81b84828151811061063957610639610da6565b60200101906001600160f81b031916908160001a9053508061065a81610d51565b91505061060e565b50600160f81b83601a8151811061067b5761067b610da6565b60200101906001600160f81b031916908160001a905350600860f81b83601c815181106106aa576106aa610da6565b60200101906001600160f81b031916908160001a905350603660005b6103008110156107f157866106dc826002610c58565b815181106106ec576106ec610da6565b602001015160f81c60f81b85838151811061070957610709610da6565b60200101906001600160f81b031916908160001a9053508661072c826001610c58565b8151811061073c5761073c610da6565b01602001516001600160f81b03191685610757846001610c58565b8151811061076757610767610da6565b60200101906001600160f81b031916908160001a90535086818151811061079057610790610da6565b01602001516001600160f81b031916856107ab846002610c58565b815181106107bb576107bb610da6565b60200101906001600160f81b031916908160001a9053506107dd600483610c58565b91506107ea600382610c58565b90506106c6565b508389604051602001610805929190610b88565b604051602081830303815290604052945050505050949350505050565b606081516000141561084257505060408051602081019091526000815290565b6000604051806060016040528060408152602001610dd360409139905060006003845160026108719190610c58565b61087b9190610c8f565b610886906004610cb1565b90506000610895826020610c58565b6001600160401b038111156108ac576108ac610dbc565b6040519080825280601f01601f1916602001820160405280156108d6576020820181803683370190505b509050818152600183018586518101602084015b818310156109445760039283018051603f601282901c811687015160f890811b8552600c83901c8216880151811b6001860152600683901c8216880151811b60028601529116860151901b938201939093526004016108ea565b60038951066001811461095e576002811461096f5761097b565b613d3d60f01b60011983015261097b565b603d60f81b6000198301525b509398975050505050505050565b600082601f83011261099a57600080fd5b81356001600160401b03808211156109b4576109b4610dbc565b604051601f8301601f19908116603f011681019082821181831017156109dc576109dc610dbc565b816040528381528660208588010111156109f557600080fd5b836020870160208301376000602085830101528094505050505092915050565b803563ffffffff81168114610a2957600080fd5b919050565b600060208284031215610a4057600080fd5b81356001600160401b03811115610a5657600080fd5b610a6284828501610989565b949350505050565b60008060008060808587031215610a8057600080fd5b84356001600160401b0380821115610a9757600080fd5b610aa388838901610989565b9550610ab160208801610a15565b9450610abf60408801610a15565b93506060870135915080821115610ad557600080fd5b50610ae287828801610989565b91505092959194509250565b60008060008060808587031215610b0457600080fd5b84356001600160401b03811115610b1a57600080fd5b610b2687828801610989565b945050610b3560208601610a15565b9250610b4360408601610a15565b9150610b5160608601610a15565b905092959194509250565b60008151808452610b74816020860160208601610d21565b601f01601f19169290920160200192915050565b60008351610b9a818460208801610d21565b835190830190610bae818360208801610d21565b01949350505050565b7519185d184e9a5b5859d94bd89b5c0ed8985cd94d8d0b60521b815260008251610be8816016850160208701610d21565b9190910160160192915050565b602081526000610c086020830184610b5c565b9392505050565b602080825260129082015271496e76616c69642064696d656e73696f6e7360701b604082015260600190565b600061ffff808316818516808303821115610bae57610bae610d90565b60008219821115610c6b57610c6b610d90565b500190565b600063ffffffff808316818516808303821115610bae57610bae610d90565b600082610cac57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615610ccb57610ccb610d90565b500290565b600063ffffffff80831681851681830481118215151615610cf357610cf3610d90565b02949350505050565b600063ffffffff83811690831681811015610d1957610d19610d90565b039392505050565b60005b83811015610d3c578181015183820152602001610d24565b83811115610d4b576000848401525b50505050565b6000600019821415610d6557610d65610d90565b5060010190565b600063ffffffff80831681811415610d8657610d86610d90565b6001019392505050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa2646970667358221220b0099612c9e049a86ddc0a96d56afcaf54549b592623ca42affe8bccaeab118864736f6c63430008070033000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000dbe0bcf4a4cb4d822850f3ed30c9d6dbdf7959b5000000000000000000000000a5409ec958c83c3f309868babaca7c86dcb077c1000000000000000000000000000000000000000000000000000000000000000942726f74636861696e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000442524f5400000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x60806040526004361061029c5760003560e01c806301ffc9a7146102a157806306fdde03146102d6578063081812fc146102f85780630927407214610325578063095ea7b31461034957806309d287d31461036b57806312d829b51461038b57806318160ddd146103ab57806320519aae146103c057806323b872dd146103e05780632635b036146104005780632d5fdb6a146104205780632f745c59146104405780633043ce861461046057806331b3eb941461048057806332bd2d6e146104a057806335036aff146104c05780633cd27480146104e05780633f4ba83a1461050057806342137f081461051557806342842e0e1461054957806344bdde08146105695780634be5eb71146105895780634c0cfe25146105bc5780634f6ccce7146105dc5780635c975abb146105fc5780636102de98146106145780636352211e146106345780636871ee401461065457806370a082311461065c578063715018a61461067c57806378a8b20d146106915780638456cb59146106b157806385df1ac1146106c6578063892d59d1146106e65780638da5cb5b14610706578063938e3d7b1461071b57806394da47e81461073b57806395d89b411461075b578063a22cb46514610770578063ad14282214610790578063adca4df0146107b0578063b7b4c4bc146107d0578063b88d4fde146107f0578063bd685bb114610810578063c002d23d14610846578063c01bd0e914610862578063c2da454714610893578063c506301d146108b3578063c87b56dd146108d3578063d191340c146108f3578063d845c86c1461090d578063dadc179e14610922578063e2982c2114610942578063e8a3d48514610962578063e985e9c514610977578063eef459f614610997578063ef59e0cd146109cb578063f2fde38b146109e0575b600080fd5b3480156102ad57600080fd5b506102c16102bc36600461512f565b610a00565b60405190151581526020015b60405180910390f35b3480156102e257600080fd5b506102eb610a11565b6040516102cd91906159b2565b34801561030457600080fd5b5061031861031336600461532b565b610aa3565b6040516102cd9190615924565b34801561033157600080fd5b5061033b60115481565b6040519081526020016102cd565b34801561035557600080fd5b50610369610364366004615074565b610b30565b005b34801561037757600080fd5b50610369610386366004615382565b610c41565b34801561039757600080fd5b506102eb6103a63660046153c8565b610d33565b3480156103b757600080fd5b50600a5461033b565b3480156103cc57600080fd5b506103696103db3660046154d8565b6111b4565b3480156103ec57600080fd5b506103696103fb366004614f93565b6112f8565b34801561040c57600080fd5b5061036961041b366004615114565b61132a565b34801561042c57600080fd5b5061036961043b36600461532b565b611393565b34801561044c57600080fd5b5061033b61045b366004615074565b6117f1565b34801561046c57600080fd5b5061036961047b36600461535d565b611887565b34801561048c57600080fd5b5061036961049b366004614f3d565b6119a7565b3480156104ac57600080fd5b506103696104bb3660046153c8565b611a28565b3480156104cc57600080fd5b506103696104db36600461532b565b611b3f565b3480156104ec57600080fd5b506103696104fb3660046153c8565b611c04565b34801561050c57600080fd5b50610369611c94565b34801561052157600080fd5b506103187f000000000000000000000000183c93b6060f997d2d30a10621998fd3a937ea6d81565b34801561055557600080fd5b50610369610564366004614f93565b611ccd565b34801561057557600080fd5b5061033b61058436600461532b565b611ce8565b34801561059557600080fd5b506105a96105a436600461532b565b611cf6565b6040516102cd9796959493929190615c3d565b3480156105c857600080fd5b506102eb6105d736600461532b565b611ef3565b3480156105e857600080fd5b5061033b6105f736600461532b565b611f26565b34801561060857600080fd5b50600c5460ff166102c1565b34801561062057600080fd5b506102c161062f366004614f5a565b611fb9565b34801561064057600080fd5b5061031861064f36600461532b565b61206b565b6103696120e2565b34801561066857600080fd5b5061033b610677366004614f3d565b612243565b34801561068857600080fd5b506103696122ca565b34801561069d57600080fd5b5061033b6106ac36600461532b565b612303565b3480156106bd57600080fd5b50610369612311565b3480156106d257600080fd5b506103696106e1366004615404565b612348565b3480156106f257600080fd5b506103696107013660046153c8565b612547565b34801561071257600080fd5b5061031861263b565b34801561072757600080fd5b506103696107363660046151ba565b61264f565b34801561074757600080fd5b506102eb6107563660046154b5565b61268a565b34801561076757600080fd5b506102eb61273c565b34801561077c57600080fd5b5061036961078b36600461503f565b61274b565b34801561079c57600080fd5b506102eb6107ab36600461532b565b61280c565b3480156107bc57600080fd5b506103696107cb3660046150a0565b6128fe565b3480156107dc57600080fd5b506103696107eb3660046153c8565b6129ac565b3480156107fc57600080fd5b5061036961080b366004614fd4565b612a36565b34801561081c57600080fd5b5061033b61082b366004614f3d565b6001600160a01b031660009081526010602052604090205490565b34801561085257600080fd5b5061033b67045c1df22dfdf00081565b34801561086e57600080fd5b5061088261087d36600461532b565b612a67565b6040516102cd959493929190615bfc565b34801561089f57600080fd5b506102eb6108ae3660046154b5565b612b37565b3480156108bf57600080fd5b506103696108ce3660046151ba565b613042565b3480156108df57600080fd5b506102eb6108ee36600461532b565b613084565b3480156108ff57600080fd5b50600f546102c19060ff1681565b34801561091957600080fd5b5061033b604081565b34801561092e57600080fd5b5061036961093d36600461532b565b613574565b34801561094e57600080fd5b5061033b61095d366004614f3d565b613685565b34801561096e57600080fd5b506102eb613724565b34801561098357600080fd5b506102c1610992366004614f5a565b613733565b3480156109a357600080fd5b506103187f000000000000000000000000dbe0bcf4a4cb4d822850f3ed30c9d6dbdf7959b581565b3480156109d757600080fd5b5061033b600281565b3480156109ec57600080fd5b506103696109fb366004614f3d565b61376e565b6000610a0b8261380b565b92915050565b606060028054610a2090615e67565b80601f0160208091040260200160405190810160405280929190818152602001828054610a4c90615e67565b8015610a995780601f10610a6e57610100808354040283529160200191610a99565b820191906000526020600020905b815481529060010190602001808311610a7c57829003601f168201915b5050505050905090565b6000610aae82613830565b610b145760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b506000908152600660205260409020546001600160a01b031690565b6000610b3b8261206b565b9050806001600160a01b0316836001600160a01b03161415610ba95760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610b0b565b336001600160a01b0382161480610bc55750610bc58133613733565b610c325760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776044820152771b995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b60421b6064820152608401610b0b565b610c3c838361384d565b505050565b600d5482908110610c645760405162461bcd60e51b8152600401610b0b90615ac1565b82600d8181548110610c7857610c78615f0d565b600091825260209091206004600790920201015460ff1615610cac5760405162461bcd60e51b8152600401610b0b90615bd5565b33610cb561263b565b6001600160a01b031614610cdb5760405162461bcd60e51b8152600401610b0b90615aef565b82600d8581548110610cef57610cef615f0d565b90600052602060002090600702016000019080519060200190610d13929190614cf6565b506040518490600080516020615fa583398151915290600090a250505050565b6060600082604051602001610d489190615784565b6040516020818303038152906040529050805161010014610d9c5760405162461bcd60e51b815260206004820152600e60248201526d323536206368617261637465727360901b6044820152606401610b0b565b6000600d610da986611ce8565b81548110610db957610db9615f0d565b90600052602060002090600702016040518061010001604052908160008201805480602002602001604051908101604052809291908181526020018280548015610e2257602002820191906000526020600020905b815481526020019060010190808311610e0e575b505050918352505060018201546020820152600282015463ffffffff8082166040840152600160201b909104166060820152600382018054608090920191610e6990615e67565b80601f0160208091040260200160405190810160405280929190818152602001828054610e9590615e67565b8015610ee25780601f10610eb757610100808354040283529160200191610ee2565b820191906000526020600020905b815481529060010190602001808311610ec557829003601f168201915b5050509183525050600482015460ff1615156020820152600582018054604090920191610f0e90615e67565b80601f0160208091040260200160405190810160405280929190818152602001828054610f3a90615e67565b8015610f875780601f10610f5c57610100808354040283529160200191610f87565b820191906000526020600020905b815481529060010190602001808311610f6a57829003601f168201915b50505050508152602001600682018054610fa090615e67565b80601f0160208091040260200160405190810160405280929190818152602001828054610fcc90615e67565b80156110195780601f10610fee57610100808354040283529160200191611019565b820191906000526020600020905b815481529060010190602001808311610ffc57829003601f168201915b50505050508152505090506000600182606001518360400151600161103e9190615d61565b6110489190615dbc565b6110529190615dff565b63ffffffff166001600160401b0381111561106f5761106f615f23565b6040519080825280601f01601f191660200182016040528015611099576020820181803683370190505b50905060006110a787611ef3565b905060008060005b83518110156111a657868482815181106110cb576110cb615f0d565b0160200151815160f89190911c9081106110e7576110e7615f0d565b602001015160f81c60f81b85838151811061110457611104615f0d565b60200101906001600160f81b031916908160001a9053508161112581615e9c565b925050828061113390615e9c565b935050856040015163ffffffff168314801561114f5750845182105b1561119457600a60f81b85838151811061116b5761116b615f0d565b60200101906001600160f81b031916908160001a9053508161118c81615e9c565b925050600092505b8061119e81615e9c565b9150506110af565b509298975050505050505050565b600d54839081106111d75760405162461bcd60e51b8152600401610b0b90615ac1565b83600d81815481106111eb576111eb615f0d565b600091825260209091206004600790920201015460ff161561121f5760405162461bcd60e51b8152600401610b0b90615bd5565b3361122861263b565b6001600160a01b03161461124e5760405162461bcd60e51b8152600401610b0b90615aef565b83600d868154811061126257611262615f0d565b906000526020600020906007020160020160006101000a81548163ffffffff021916908363ffffffff16021790555082600d86815481106112a5576112a5615f0d565b600091825260208220600260079092020101805463ffffffff93909316600160201b0263ffffffff60201b19909316929092179091556040518691600080516020615fa583398151915291a25050505050565b611303335b826138bb565b61131f5760405162461bcd60e51b8152600401610b0b90615b84565b610c3c83838361397d565b3361133361263b565b6001600160a01b0316146113595760405162461bcd60e51b8152600401610b0b90615aef565b600f805460ff19168215151790556040517f2e333d757ff21cd43147d6ff03380cc5abebbbb47cdd7a651f58c8980b4d994190600090a150565b600d54819081106113b65760405162461bcd60e51b8152600401610b0b90615ac1565b336113bf61263b565b6001600160a01b0316146113e55760405162461bcd60e51b8152600401610b0b90615aef565b6000600d83815481106113fa576113fa615f0d565b9060005260206000209060070201604051806101000160405290816000820180548060200260200160405190810160405280929190818152602001828054801561146357602002820191906000526020600020905b81548152602001906001019080831161144f575b505050918352505060018201546020820152600282015463ffffffff8082166040840152600160201b9091041660608201526003820180546080909201916114aa90615e67565b80601f01602080910402602001604051908101604052809291908181526020018280546114d690615e67565b80156115235780601f106114f857610100808354040283529160200191611523565b820191906000526020600020905b81548152906001019060200180831161150657829003601f168201915b5050509183525050600482015460ff161515602082015260058201805460409092019161154f90615e67565b80601f016020809104026020016040519081016040528092919081815260200182805461157b90615e67565b80156115c85780601f1061159d576101008083540402835291602001916115c8565b820191906000526020600020905b8154815290600101906020018083116115ab57829003601f168201915b505050505081526020016006820180546115e190615e67565b80601f016020809104026020016040519081016040528092919081815260200182805461160d90615e67565b801561165a5780601f1061162f5761010080835404028352916020019161165a565b820191906000526020600020905b81548152906001019060200180831161163d57829003601f168201915b5050505050815250509050600080600090505b825151811015611756577f000000000000000000000000dbe0bcf4a4cb4d822850f3ed30c9d6dbdf7959b56001600160a01b0316630b50f5aa846000015183815181106116bc576116bc615f0d565b60200260200101516040518263ffffffff1660e01b81526004016116e291815260200190565b60006040518083038186803b1580156116fa57600080fd5b505afa15801561170e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526117369190810190615236565b51516117429083615d49565b91508061174e81615e9c565b91505061166d565b50808260600151836040015161176c9190615dbc565b63ffffffff16146117b45760405162461bcd60e51b8152602060048201526012602482015271496e76616c69642064696d656e73696f6e7360701b6044820152606401610b0b565b6001600d85815481106117c9576117c9615f0d565b60009182526020909120600790910201600401805460ff191691151591909117905550505050565b60006117fc83612243565b821061185e5760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610b0b565b506001600160a01b03919091166000908152600860209081526040808320938352929052205490565b611892335b836138bb565b6118d75760405162461bcd60e51b815260206004820152601660248201527527b7363c9037bbb732b91037b91030b8383937bb32b960511b6044820152606401610b0b565b60006118e28361206b565b9050806001600160a01b0316826001600160a01b0316141561193e5760405162461bcd60e51b815260206004820152601560248201527420b8383937bb34b733903a37b5b2b71037bbb732b960591b6044820152606401610b0b565b6000838152600e60205260409081902060020180546001600160a01b0319166001600160a01b0385161790555183907f37d54eb27386ac5215a0df35ab1824dea2beac452cda1eecda9ec366807600a89061199a908590615924565b60405180910390a2505050565b6040516351cff8d960e01b81526001600160a01b037f000000000000000000000000392d4822b83bcf61e24d87215c82182be938e01716906351cff8d9906119f3908490600401615924565b600060405180830381600087803b158015611a0d57600080fd5b505af1158015611a21573d6000803e3d6000fd5b5050505050565b81611a32336112fd565b80611a5657506000818152600e60205260409020600201546001600160a01b031633145b611a725760405162461bcd60e51b8152600401610b0b90615b24565b815161030014611a945760405162461bcd60e51b8152600401610b0b90615b56565b6000838152600e602090815260409091208351611ab992600490920191850190614d41565b506000838152600e60205260408120805491611ad483615e9c565b9190505550611ae03390565b6000848152600e60205260408082206001810180546001600160a01b0319166001600160a01b039590951694909417909355600390920180546001600160c01b031916905590518491600080516020615f6583398151915291a2505050565b600d5481908110611b625760405162461bcd60e51b8152600401610b0b90615ac1565b33611b6b61263b565b6001600160a01b031614611b915760405162461bcd60e51b8152600401610b0b90615aef565b6002600d8381548110611ba657611ba6615f0d565b90600052602060002090600702016001015410611bf75760405162461bcd60e51b815260206004820152600f60248201526e446f6e27742062652067726565647960881b6044820152606401610b0b565b611c0082613b16565b5050565b600d5482908110611c275760405162461bcd60e51b8152600401610b0b90615ac1565b33611c3061263b565b6001600160a01b031614611c565760405162461bcd60e51b8152600401610b0b90615aef565b81600d8481548110611c6a57611c6a615f0d565b90600052602060002090600702016006019080519060200190611c8e929190614d41565b50505050565b33611c9d61263b565b6001600160a01b031614611cc35760405162461bcd60e51b8152600401610b0b90615aef565b611ccb613feb565b565b610c3c83838360405180602001604052806000815250612a36565b6000610a0b61271083615d89565b600d8181548110611d0657600080fd5b600091825260209091206007909102016001810154600282015460038301805492945063ffffffff80831694600160201b9093041692611d4590615e67565b80601f0160208091040260200160405190810160405280929190818152602001828054611d7190615e67565b8015611dbe5780601f10611d9357610100808354040283529160200191611dbe565b820191906000526020600020905b815481529060010190602001808311611da157829003601f168201915b5050506004840154600585018054949560ff909216949193509150611de290615e67565b80601f0160208091040260200160405190810160405280929190818152602001828054611e0e90615e67565b8015611e5b5780601f10611e3057610100808354040283529160200191611e5b565b820191906000526020600020905b815481529060010190602001808311611e3e57829003601f168201915b505050505090806006018054611e7090615e67565b80601f0160208091040260200160405190810160405280929190818152602001828054611e9c90615e67565b8015611ee95780601f10611ebe57610100808354040283529160200191611ee9565b820191906000526020600020905b815481529060010190602001808311611ecc57829003601f168201915b5050505050905087565b6060611efe82613830565b611f1a5760405162461bcd60e51b8152600401610b0b90615a42565b610a0b6107ab83611ce8565b6000611f31600a5490565b8210611f945760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610b0b565b600a8281548110611fa757611fa7615f0d565b90600052602060002001549050919050565b6001546000906001600160a01b031680158015906120635750826001600160a01b0316816001600160a01b031663c4552791866040518263ffffffff1660e01b81526004016120089190615924565b60206040518083038186803b15801561202057600080fd5b505afa158015612034573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612058919061519d565b6001600160a01b0316145b949350505050565b6000818152600460205260408120546001600160a01b031680610a0b5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610b0b565b67045c1df22dfdf0003410156121315760405162461bcd60e51b8152602060048201526014602482015273125b9cdd59999a58da595b9d081c185e5b595b9d60621b6044820152606401610b0b565b61214261213c61263b565b34614078565b600d546000813360115460405160609290921b6001600160601b031916602083015242603483015260548201526074016040516020818303038152906040528051906020012060001c6121959190615eb7565b905060005b82811015612204576000836121af8385615d49565b6121b99190615eb7565b90506040600d82815481106121d0576121d0615f0d565b90600052602060002090600702016001015410156121f157611c8e81613b16565b50806121fc81615e9c565b91505061219a565b5060405162461bcd60e51b8152602060048201526013602482015272105b1b081cd95c9a595cc81cdbdb19081bdd5d606a1b6044820152606401610b0b565b60006001600160a01b0382166122ae5760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610b0b565b506001600160a01b031660009081526005602052604090205490565b336122d361263b565b6001600160a01b0316146122f95760405162461bcd60e51b8152600401610b0b90615aef565b611ccb60006140fc565b6000610a0b61271083615eb7565b3361231a61263b565b6001600160a01b0316146123405760405162461bcd60e51b8152600401610b0b90615aef565b611ccb614156565b3361235161263b565b6001600160a01b0316146123775760405162461bcd60e51b8152600401610b0b90615aef565b600d5486146123c05760405162461bcd60e51b8152602060048201526015602482015274125b9d985b1a59081b995dc81cd95c9a595cc81251605a1b6044820152606401610b0b565b600d604051806101000160405280858152602001600081526020018463ffffffff1681526020018363ffffffff16815260200160006001600160401b0381111561240c5761240c615f23565b6040519080825280601f01601f191660200182016040528015612436576020820181803683370190505b50815260006020808301829052604083018a9052606090920188905283546001810185559381528190208251805193946007029091019261247a9284920190614cf6565b5060208281015160018301556040830151600283018054606086015163ffffffff908116600160201b026001600160401b0319909216931692909217919091179055608083015180516124d39260038501920190614d41565b5060a082015160048201805460ff191691151591909117905560c08201518051612507916005840191602090910190614d41565b5060e08201518051612523916006840191602090910190614d41565b5050604051879150600080516020615fa583398151915290600090a2505050505050565b600d548290811061256a5760405162461bcd60e51b8152600401610b0b90615ac1565b82600d818154811061257e5761257e615f0d565b600091825260209091206004600790920201015460ff16156125b25760405162461bcd60e51b8152600401610b0b90615bd5565b336125bb61263b565b6001600160a01b0316146125e15760405162461bcd60e51b8152600401610b0b90615aef565b8251610300146126035760405162461bcd60e51b8152600401610b0b90615b56565b82600d858154811061261757612617615f0d565b90600052602060002090600702016003019080519060200190611a21929190614d41565b600c5461010090046001600160a01b031690565b3361265861263b565b6001600160a01b03161461267e5760405162461bcd60e51b8152600401610b0b90615aef565b612687816141d1565b50565b60607f000000000000000000000000183c93b6060f997d2d30a10621998fd3a937ea6d6001600160a01b0316639f6aaa926126c58585612b37565b6040518263ffffffff1660e01b81526004016126e191906159b2565b60006040518083038186803b1580156126f957600080fd5b505afa15801561270d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261273591908101906151ee565b9392505050565b606060038054610a2090615e67565b6001600160a01b0382163314156127a05760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b6044820152606401610b0b565b3360008181526007602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b600d54606090829081106128325760405162461bcd60e51b8152600401610b0b90615ac1565b7f000000000000000000000000dbe0bcf4a4cb4d822850f3ed30c9d6dbdf7959b56001600160a01b0316630b6093d1600d858154811061287457612874615f0d565b90600052602060002090600702016000016040518263ffffffff1660e01b81526004016128a1919061596b565b60006040518083038186803b1580156128b957600080fd5b505afa1580156128cd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526128f59190810190615169565b91505b50919050565b3361290761263b565b6001600160a01b03161461292d5760405162461bcd60e51b8152600401610b0b90615aef565b60005b81811015610c3c5782828281811061294a5761294a615f0d565b905060400201602001356010600085858581811061296a5761296a615f0d565b6129809260206040909202019081019150614f3d565b6001600160a01b03168152602081019190915260400160002055806129a481615e9c565b915050612930565b600d54829081106129cf5760405162461bcd60e51b8152600401610b0b90615ac1565b336129d861263b565b6001600160a01b0316146129fe5760405162461bcd60e51b8152600401610b0b90615aef565b81600d8481548110612a1257612a12615f0d565b90600052602060002090600702016005019080519060200190611c8e929190614d41565b612a3f3361188c565b612a5b5760405162461bcd60e51b8152600401610b0b90615b84565b611c8e848484846141e4565b600e602052600090815260409020805460018201546002830154600384015460048501805494956001600160a01b039485169593909416936001600160c01b0390921692612ab490615e67565b80601f0160208091040260200160405190810160405280929190818152602001828054612ae090615e67565b8015612b2d5780601f10612b0257610100808354040283529160200191612b2d565b820191906000526020600020905b815481529060010190602001808311612b1057829003601f168201915b5050505050905085565b6060612b4283613830565b612b5e5760405162461bcd60e51b8152600401610b0b90615a42565b6000600d612b6b85611ce8565b81548110612b7b57612b7b615f0d565b90600052602060002090600702016040518061010001604052908160008201805480602002602001604051908101604052809291908181526020018280548015612be457602002820191906000526020600020905b815481526020019060010190808311612bd0575b505050918352505060018201546020820152600282015463ffffffff8082166040840152600160201b909104166060820152600382018054608090920191612c2b90615e67565b80601f0160208091040260200160405190810160405280929190818152602001828054612c5790615e67565b8015612ca45780601f10612c7957610100808354040283529160200191612ca4565b820191906000526020600020905b815481529060010190602001808311612c8757829003601f168201915b5050509183525050600482015460ff1615156020820152600582018054604090920191612cd090615e67565b80601f0160208091040260200160405190810160405280929190818152602001828054612cfc90615e67565b8015612d495780601f10612d1e57610100808354040283529160200191612d49565b820191906000526020600020905b815481529060010190602001808311612d2c57829003601f168201915b50505050508152602001600682018054612d6290615e67565b80601f0160208091040260200160405190810160405280929190818152602001828054612d8e90615e67565b8015612ddb5780601f10612db057610100808354040283529160200191612ddb565b820191906000526020600020905b815481529060010190602001808311612dbe57829003601f168201915b50505050508152505090506000612df185614217565b5090506000612dff86611ef3565b905060018563ffffffff161115612f8b577f000000000000000000000000183c93b6060f997d2d30a10621998fd3a937ea6d6001600160a01b031663e4c4ed997f000000000000000000000000183c93b6060f997d2d30a10621998fd3a937ea6d6001600160a01b031663acb261b584876040015188606001518b6040518563ffffffff1660e01b8152600401612e999493929190615a09565b60006040518083038186803b158015612eb157600080fd5b505afa158015612ec5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612eed9190810190615169565b878660400151612efd9190615dbc565b888760600151612f0d9190615dbc565b866040518563ffffffff1660e01b8152600401612f2d94939291906159c5565b60006040518083038186803b158015612f4557600080fd5b505afa158015612f59573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612f819190810190615169565b9350505050610a0b565b6040808401516060850151915163e4c4ed9960e01b81526001600160a01b037f000000000000000000000000183c93b6060f997d2d30a10621998fd3a937ea6d169263e4c4ed9992612fe49286929088906004016159c5565b60006040518083038186803b158015612ffc57600080fd5b505afa158015613010573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526130389190810190615169565b9695505050505050565b3361304b61263b565b6001600160a01b0316146130715760405162461bcd60e51b8152600401610b0b90615aef565b8051611c00906012906020840190614d41565b6000818152600e60209081526040808320815160a0810183528154815260018201546001600160a01b039081169482019490945260028201549093169183019190915260038101546001600160c01b031660608381019190915260048201805491949392916080840191906130f890615e67565b80601f016020809104026020016040519081016040528092919081815260200182805461312490615e67565b80156131715780601f1061314657610100808354040283529160200191613171565b820191906000526020600020905b81548152906001019060200180831161315457829003601f168201915b50505050508152505090506000600d61318985611ce8565b8154811061319957613199615f0d565b9060005260206000209060070201604051806101000160405290816000820180548060200260200160405190810160405280929190818152602001828054801561320257602002820191906000526020600020905b8154815260200190600101908083116131ee575b505050918352505060018201546020820152600282015463ffffffff8082166040840152600160201b90910416606082015260038201805460809092019161324990615e67565b80601f016020809104026020016040519081016040528092919081815260200182805461327590615e67565b80156132c25780601f10613297576101008083540402835291602001916132c2565b820191906000526020600020905b8154815290600101906020018083116132a557829003601f168201915b5050509183525050600482015460ff16151560208201526005820180546040909201916132ee90615e67565b80601f016020809104026020016040519081016040528092919081815260200182805461331a90615e67565b80156133675780601f1061333c57610100808354040283529160200191613367565b820191906000526020600020905b81548152906001019060200180831161334a57829003601f168201915b5050505050815260200160068201805461338090615e67565b80601f01602080910402602001604051908101604052809291908181526020018280546133ac90615e67565b80156133f95780601f106133ce576101008083540402835291602001916133f9565b820191906000526020600020905b8154815290600101906020018083116133dc57829003601f168201915b5050505050815250509050600061340f85612303565b905060008260c00151613421836144a4565b8460e0015160126134318a6144a4565b6040516020016134459594939291906157a0565b6040516020818303038152906040529050808360c0015161346986600001516144a4565b60405160200161347b93929190615604565b60408051601f1981840301815291905260208501519091506001600160a01b0316156134dd57806134ba85602001516001600160a01b031660146145a1565b6040516020016134cb9291906156fa565b60405160208183030381529060405290505b60006134e887614217565b91505080156135145781604051602001613502919061555c565b60405160208183030381529060405291505b8261353c578160405160200161352a91906156c2565b60405160208183030381529060405291505b8161354888600161268a565b60405160200161355992919061559d565b60405160208183030381529060405295505050505050919050565b8061357e336112fd565b806135a257506000818152600e60205260409020600201546001600160a01b031633145b6135be5760405162461bcd60e51b8152600401610b0b90615b24565b6000828152600e60205260409020600301546001600160c01b0316156136165760405162461bcd60e51b815260206004820152600d60248201526c105b1c9958591e481c995cd95d609a1b6044820152606401610b0b565b6000828152600e6020526040812080549161363083615e9c565b90915550506000828152600e6020526040808220600180820180546001600160a01b0319169055600390910180546001600160c01b0319169091179055518391600080516020615f6583398151915291a25050565b6040516371d4ed8d60e11b81526000906001600160a01b037f000000000000000000000000392d4822b83bcf61e24d87215c82182be938e017169063e3a9db1a906136d4908590600401615924565b60206040518083038186803b1580156136ec57600080fd5b505afa158015613700573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0b9190615344565b606060008054610a2090615e67565b6001600160a01b03808316600090815260076020908152604080832093851683529290529081205460ff168061273557506127358383611fb9565b3361377761263b565b6001600160a01b03161461379d5760405162461bcd60e51b8152600401610b0b90615aef565b6001600160a01b0381166138025760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610b0b565b612687816140fc565b60006001600160e01b0319821663780e9d6360e01b1480610a0b5750610a0b8261473c565b6000908152600460205260409020546001600160a01b0316151590565b600081815260066020526040902080546001600160a01b0319166001600160a01b03841690811790915581906138828261206b565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60006138c682613830565b6139275760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610b0b565b60006139328361206b565b9050806001600160a01b0316846001600160a01b0316148061396d5750836001600160a01b031661396284610aa3565b6001600160a01b0316145b8061206357506120638185613733565b826001600160a01b03166139908261206b565b6001600160a01b0316146139f85760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610b0b565b6001600160a01b038216613a5a5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610b0b565b613a6583838361478c565b613a7060008261384d565b6001600160a01b0383166000908152600560205260408120805460019290613a99908490615de8565b90915550506001600160a01b0382166000908152600560205260408120805460019290613ac7908490615d49565b909155505060008181526004602052604080822080546001600160a01b0319166001600160a01b038681169182179092559151849391871691600080516020615f8583398151915291a4505050565b600d5481908110613b395760405162461bcd60e51b8152600401610b0b90615ac1565b613b4161263b565b6001600160a01b0316336001600160a01b031614613c2857600f5460ff1615613bda573360008181526010602052604090205490613b7e90612243565b10613bd55760405162461bcd60e51b815260206004820152602160248201527f4561726c79206163636573732065786861757374656420666f722077616c6c656044820152601d60fa1b6064820152608401610b0b565b613c28565b600d54613be633612243565b10613c285760405162461bcd60e51b815260206004820152601260248201527115d85b1b195d0818d85c081c995858da195960721b6044820152606401610b0b565b6000600d8381548110613c3d57613c3d615f0d565b90600052602060002090600702016040518061010001604052908160008201805480602002602001604051908101604052809291908181526020018280548015613ca657602002820191906000526020600020905b815481526020019060010190808311613c92575b505050918352505060018201546020820152600282015463ffffffff8082166040840152600160201b909104166060820152600382018054608090920191613ced90615e67565b80601f0160208091040260200160405190810160405280929190818152602001828054613d1990615e67565b8015613d665780601f10613d3b57610100808354040283529160200191613d66565b820191906000526020600020905b815481529060010190602001808311613d4957829003601f168201915b5050509183525050600482015460ff1615156020820152600582018054604090920191613d9290615e67565b80601f0160208091040260200160405190810160405280929190818152602001828054613dbe90615e67565b8015613e0b5780601f10613de057610100808354040283529160200191613e0b565b820191906000526020600020905b815481529060010190602001808311613dee57829003601f168201915b50505050508152602001600682018054613e2490615e67565b80601f0160208091040260200160405190810160405280929190818152602001828054613e5090615e67565b8015613e9d5780601f10613e7257610100808354040283529160200191613e9d565b820191906000526020600020905b815481529060010190602001808311613e8057829003601f168201915b50505050508152505090506000816020015161271085613ebd9190615d9d565b613ec79190615d49565b60118190556040805160a08101825260008082526020808301828152838501838152606085018481528651858152808501885260808701908152888652600e8552969094208551815591516001830180546001600160a01b03199081166001600160a01b03938416179091559151600284018054909316911617905591516003830180546001600160c01b0319166001600160c01b039092169190911790559251805194955091939092613f82926004850192910190614d41565b50905050600d8481548110613f9957613f99615f0d565b600091825260208220600160079092020101805491613fb783615e9c565b9190505550613fcc613fc63390565b826147b6565b6040518190600080516020615f6583398151915290600090a250505050565b600c5460ff166140345760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610b0b565b600c805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405161406e9190615924565b60405180910390a1565b60405163f340fa0160e01b81526001600160a01b037f000000000000000000000000392d4822b83bcf61e24d87215c82182be938e017169063f340fa019083906140c6908690600401615924565b6000604051808303818588803b1580156140df57600080fd5b505af11580156140f3573d6000803e3d6000fd5b50505050505050565b600c80546001600160a01b03838116610100818102610100600160a81b031985161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600c5460ff161561419c5760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610b0b565b600c805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586140613390565b8051611c00906000906020840190614d41565b6141ef84848461397d565b6141fb848484846147d0565b611c8e5760405162461bcd60e51b8152600401610b0b90615a6f565b6000818152600e60209081526040808320815160a0810183528154815260018201546001600160a01b039081169482019490945260028201549093169183019190915260038101546001600160c01b0316606083810191909152600482018054919493849390929091608084019161428e90615e67565b80601f01602080910402602001604051908101604052809291908181526020018280546142ba90615e67565b80156143075780601f106142dc57610100808354040283529160200191614307565b820191906000526020600020905b8154815290600101906020018083116142ea57829003601f168201915b5050505050815250509050600081608001519050600082606001516001600160c01b03166001148061433857508151155b9050801561449957600d61434b87611ce8565b8154811061435b5761435b615f0d565b9060005260206000209060070201600301805461437790615e67565b80601f01602080910402602001604051908101604052809291908181526020018280546143a390615e67565b80156143f05780601f106143c5576101008083540402835291602001916143f0565b820191906000526020600020905b8154815290600101906020018083116143d357829003601f168201915b50505050509150815160001415614499577f000000000000000000000000183c93b6060f997d2d30a10621998fd3a937ea6d6001600160a01b0316631abe81a16040518163ffffffff1660e01b815260040160006040518083038186803b15801561445a57600080fd5b505afa15801561446e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526144969190810190615169565b91505b909590945092505050565b6060816144c85750506040805180820190915260018152600360fc1b602082015290565b8160005b81156144f257806144dc81615e9c565b91506144eb9050600a83615d89565b91506144cc565b6000816001600160401b0381111561450c5761450c615f23565b6040519080825280601f01601f191660200182016040528015614536576020820181803683370190505b5090505b84156120635761454b600183615de8565b9150614558600a86615eb7565b614563906030615d49565b60f81b81838151811061457857614578615f0d565b60200101906001600160f81b031916908160001a90535061459a600a86615d89565b945061453a565b606060006145b0836002615d9d565b6145bb906002615d49565b6001600160401b038111156145d2576145d2615f23565b6040519080825280601f01601f1916602001820160405280156145fc576020820181803683370190505b509050600360fc1b8160008151811061461757614617615f0d565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061464657614646615f0d565b60200101906001600160f81b031916908160001a905350600061466a846002615d9d565b614675906001615d49565b90505b60018111156146ed576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106146a9576146a9615f0d565b1a60f81b8282815181106146bf576146bf615f0d565b60200101906001600160f81b031916908160001a90535060049490941c936146e681615e50565b9050614678565b5083156127355760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610b0b565b60006001600160e01b031982166380ac58cd60e01b148061476d57506001600160e01b03198216635b5e139f60e01b145b80610a0b57506301ffc9a760e01b6001600160e01b0319831614610a0b565b6000818152600e6020526040902060020180546001600160a01b0319169055610c3c8383836148dd565b611c0082826040518060200160405280600081525061494f565b60006001600160a01b0384163b156148d257604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290614814903390899088908890600401615938565b602060405180830381600087803b15801561482e57600080fd5b505af192505050801561485e575060408051601f3d908101601f1916820190925261485b9181019061514c565b60015b6148b8573d80801561488c576040519150601f19603f3d011682016040523d82523d6000602084013e614891565b606091505b5080516148b05760405162461bcd60e51b8152600401610b0b90615a6f565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050612063565b506001949350505050565b6148e8838383614982565b600c5460ff1615610c3c5760405162461bcd60e51b815260206004820152602b60248201527f4552433732315061757361626c653a20746f6b656e207472616e73666572207760448201526a1a1a5b19481c185d5cd95960aa1b6064820152608401610b0b565b6149598383614a3a565b61496660008484846147d0565b610c3c5760405162461bcd60e51b8152600401610b0b90615a6f565b6001600160a01b0383166149dd576149d881600a80546000838152600b60205260408120829055600182018355919091527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80155565b614a00565b816001600160a01b0316836001600160a01b031614614a0057614a008382614b66565b6001600160a01b038216614a1757610c3c81614c03565b826001600160a01b0316826001600160a01b031614610c3c57610c3c8282614cb2565b6001600160a01b038216614a905760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610b0b565b614a9981613830565b15614ae55760405162461bcd60e51b815260206004820152601c60248201527b115490cdcc8c4e881d1bdad95b88185b1c9958591e481b5a5b9d195960221b6044820152606401610b0b565b614af16000838361478c565b6001600160a01b0382166000908152600560205260408120805460019290614b1a908490615d49565b909155505060008181526004602052604080822080546001600160a01b0319166001600160a01b0386169081179091559051839290600080516020615f85833981519152908290a45050565b60006001614b7384612243565b614b7d9190615de8565b600083815260096020526040902054909150808214614bd0576001600160a01b03841660009081526008602090815260408083208584528252808320548484528184208190558352600990915290208190555b5060009182526009602090815260408084208490556001600160a01b039094168352600881528383209183525290812055565b600a54600090614c1590600190615de8565b6000838152600b6020526040812054600a8054939450909284908110614c3d57614c3d615f0d565b9060005260206000200154905080600a8381548110614c5e57614c5e615f0d565b6000918252602080832090910192909255828152600b9091526040808220849055858252812055600a805480614c9657614c96615ef7565b6001900381819060005260206000200160009055905550505050565b6000614cbd83612243565b6001600160a01b039093166000908152600860209081526040808320868452825280832085905593825260099052919091209190915550565b828054828255906000526020600020908101928215614d31579160200282015b82811115614d31578251825591602001919060010190614d16565b50614d3d929150614db4565b5090565b828054614d4d90615e67565b90600052602060002090601f016020900481019282614d6f5760008555614d31565b82601f10614d8857805160ff1916838001178555614d31565b82800160010185558215614d315791820182811115614d31578251825591602001919060010190614d16565b5b80821115614d3d5760008155600101614db5565b6000614ddc614dd784615d22565b615cf2565b9050828152838383011115614df057600080fd5b612735836020830184615e24565b600082601f830112614e0f57600080fd5b813560206001600160401b03821115614e2a57614e2a615f23565b8160051b614e39828201615cf2565b838152828101908684018388018501891015614e5457600080fd5b600093505b85841015614e77578035835260019390930192918401918401614e59565b50979650505050505050565b80358015158114614e9357600080fd5b919050565b600082601f830112614ea957600080fd5b8135614eb7614dd782615d22565b818152846020838601011115614ecc57600080fd5b816020850160208301376000918101602001919091529392505050565b600082601f830112614efa57600080fd5b61273583835160208501614dc9565b805160058110614e9357600080fd5b803563ffffffff81168114614e9357600080fd5b805160ff81168114614e9357600080fd5b600060208284031215614f4f57600080fd5b813561273581615f39565b60008060408385031215614f6d57600080fd5b8235614f7881615f39565b91506020830135614f8881615f39565b809150509250929050565b600080600060608486031215614fa857600080fd5b8335614fb381615f39565b92506020840135614fc381615f39565b929592945050506040919091013590565b60008060008060808587031215614fea57600080fd5b8435614ff581615f39565b9350602085013561500581615f39565b92506040850135915060608501356001600160401b0381111561502757600080fd5b61503387828801614e98565b91505092959194509250565b6000806040838503121561505257600080fd5b823561505d81615f39565b915061506b60208401614e83565b90509250929050565b6000806040838503121561508757600080fd5b823561509281615f39565b946020939093013593505050565b600080602083850312156150b357600080fd5b82356001600160401b03808211156150ca57600080fd5b818501915085601f8301126150de57600080fd5b8135818111156150ed57600080fd5b8660208260061b850101111561510257600080fd5b60209290920196919550909350505050565b60006020828403121561512657600080fd5b61273582614e83565b60006020828403121561514157600080fd5b813561273581615f4e565b60006020828403121561515e57600080fd5b815161273581615f4e565b60006020828403121561517b57600080fd5b81516001600160401b0381111561519157600080fd5b61206384828501614ee9565b6000602082840312156151af57600080fd5b815161273581615f39565b6000602082840312156151cc57600080fd5b81356001600160401b038111156151e257600080fd5b61206384828501614e98565b60006020828403121561520057600080fd5b81516001600160401b0381111561521657600080fd5b8201601f8101841361522757600080fd5b61206384825160208401614dc9565b60006020828403121561524857600080fd5b81516001600160401b038082111561525f57600080fd5b9083019081850361010081121561527557600080fd5b61527d615ca8565b83518381111561528c57600080fd5b61529888828701614ee9565b82525060e0601f19830112156152ad57600080fd5b6152b5615cd0565b92506020840151835260408401516020840152606084015160408401526080840151606084015260a084015191508160010b82146152f257600080fd5b81608084015261530460c08501614f2c565b60a084015261531560e08501614f09565b60c0840152602081019290925250949350505050565b60006020828403121561533d57600080fd5b5035919050565b60006020828403121561535657600080fd5b5051919050565b6000806040838503121561537057600080fd5b823591506020830135614f8881615f39565b6000806040838503121561539557600080fd5b8235915060208301356001600160401b038111156153b257600080fd5b6153be85828601614dfe565b9150509250929050565b600080604083850312156153db57600080fd5b8235915060208301356001600160401b038111156153f857600080fd5b6153be85828601614e98565b60008060008060008060c0878903121561541d57600080fd5b8635955060208701356001600160401b038082111561543b57600080fd5b6154478a838b01614e98565b9650604089013591508082111561545d57600080fd5b6154698a838b01614e98565b9550606089013591508082111561547f57600080fd5b5061548c89828a01614dfe565b93505061549b60808801614f18565b91506154a960a08801614f18565b90509295509295509295565b600080604083850312156154c857600080fd5b8235915061506b60208401614f18565b6000806000606084860312156154ed57600080fd5b833592506154fd60208501614f18565b915061550b60408501614f18565b90509250925092565b6000815180845261552c816020860160208601615e24565b601f01601f19169290920160200192915050565b60008151615552818560208601615e24565b9290920192915050565b6000825161556e818460208701615e24565b7f2c7b2276616c7565223a224f726967696e616c2050616c65747465227d000000920191825250601d01919050565b600083516155af818460208801615e24565b61174b60f21b908301908152681134b6b0b3b2911d1160b91b600282015283516155e081600b840160208801615e24565b601160f91b600b9290910191820152607d60f81b600c820152600d01949350505050565b60008451615616818460208901615e24565b771130ba3a3934b13aba32b9911d2dbd913b30b63ab2911d1160411b908301908152845161564b816018840160208901615e24565b63227d2c7b60e01b601892909101918201527f2274726169745f74797065223a2250616c65747465204368616e676573222c00601c82015267113b30b63ab2911d60c11b603b82015283516156a7816043840160208801615e24565b607d60f81b6043929091019182015260440195945050505050565b600082516156d4818460208701615e24565b732c7b2276616c7565223a2247656e65736973227d60601b920191825250601401919050565b6000835161570c818460208801615e24565b612c7b60f01b90830190815279089d1c985a5d17dd1e5c19488e8894185b195d1d1948109e488b60321b600282015268113b30b63ab2911d1160b91b601c8201528351615760816025840160208801615e24565b601160f91b60259290910191820152607d60f81b6026820152602701949350505050565b60008251615796818460208701615e24565b9190910192915050565b76646174613a6170706c69636174696f6e2f6a736f6e2c7b60481b815267113730b6b2911d1160c11b6017820152855160009060206157e582601f8601838c01615e24565b61202360f01b601f9285019283015287516158068160218501848c01615e24565b61088b60f21b602193909101928301526e113232b9b1b934b83a34b7b7111d1160891b602383015286516158408160328501848b01615e24565b7111161132bc3a32b93730b62fbab936111d1160711b603293909101928301528554604490600090600181811c908083168061587d57607f831692505b86831081141561589b57634e487b7160e01b85526022600452602485fd5b8080156158af57600181146158c4576158f5565b60ff19851689880152838901870195506158f5565b60008d81526020902060005b858110156158eb5781548b82018a01529084019089016158d0565b505086848a010195505b50505050506159156159078289615540565b61088b60f21b815260020190565b9b9a5050505050505050505050565b6001600160a01b0391909116815260200190565b6001600160a01b038581168252841660208201526040810183905260806060820181905260009061303890830184615514565b6020808252825482820181905260008481528281209092916040850190845b818110156159a65783548352600193840193928501920161598a565b50909695505050505050565b6020815260006127356020830184615514565b6080815260006159d86080830187615514565b63ffffffff86811660208501528516604084015282810360608401526159fe8185615514565b979650505050505050565b608081526000615a1c6080830187615514565b63ffffffff95861660208401529385166040830152509216606090920191909152919050565b602080825260139082015272151bdad95b88191bd95cdb89dd08195e1a5cdd606a1b604082015260600190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60208082526014908201527314d95c9a595cc8191bd95cdb89dd08195e1a5cdd60621b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601890820152774e6f7420617070726f76656420666f722070616c6574746560401b604082015260600190565b6020808252601490820152730c8d4d8818dbdb1bdd5c9cc81c995c5d5a5c995960621b604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6020808252600d908201526c14d95c9a595cc81b1bd8dad959609a1b604082015260600190565b8581526001600160a01b038581166020830152841660408201526001600160c01b038316606082015260a0608082018190526000906159fe90830184615514565b878152600063ffffffff808916602084015280881660408401525060e06060830152615c6c60e0830187615514565b851515608084015282810360a0840152615c868186615514565b905082810360c0840152615c9a8185615514565b9a9950505050505050505050565b604080519081016001600160401b0381118282101715615cca57615cca615f23565b60405290565b60405160e081016001600160401b0381118282101715615cca57615cca615f23565b604051601f8201601f191681016001600160401b0381118282101715615d1a57615d1a615f23565b604052919050565b60006001600160401b03821115615d3b57615d3b615f23565b50601f01601f191660200190565b60008219821115615d5c57615d5c615ecb565b500190565b600063ffffffff808316818516808303821115615d8057615d80615ecb565b01949350505050565b600082615d9857615d98615ee1565b500490565b6000816000190483118215151615615db757615db7615ecb565b500290565b600063ffffffff80831681851681830481118215151615615ddf57615ddf615ecb565b02949350505050565b600082821015615dfa57615dfa615ecb565b500390565b600063ffffffff83811690831681811015615e1c57615e1c615ecb565b039392505050565b60005b83811015615e3f578181015183820152602001615e27565b83811115611c8e5750506000910152565b600081615e5f57615e5f615ecb565b506000190190565b600181811c90821680615e7b57607f821691505b602082108114156128f857634e487b7160e01b600052602260045260246000fd5b6000600019821415615eb057615eb0615ecb565b5060010190565b600082615ec657615ec6615ee1565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461268757600080fd5b6001600160e01b03198116811461268757600080fdfe76022b77c5b8d574c916a2ccc9ca03ca662f103473c0259a685c631922a1c706ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef75d0bf101ba113aff2a04b66a97ecc5b3658d8e6b47247d625c675f64a8acc29a2646970667358221220a7db30d08c6a67982bbb27fa7b5fb98aba6781e984d368077fada743f1f385f064736f6c63430008070033

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

000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000dbe0bcf4a4cb4d822850f3ed30c9d6dbdf7959b5000000000000000000000000a5409ec958c83c3f309868babaca7c86dcb077c1000000000000000000000000000000000000000000000000000000000000000942726f74636861696e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000442524f5400000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : name (string): Brotchain
Arg [1] : symbol (string): BROT
Arg [2] : brots (address): 0xDBE0bcF4A4cB4d822850f3ed30c9D6dbDf7959B5
Arg [3] : openSeaProxyRegistry (address): 0xa5409ec958C83C3f309868babACA7c86DCB077c1

-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [2] : 000000000000000000000000dbe0bcf4a4cb4d822850f3ed30c9d6dbdf7959b5
Arg [3] : 000000000000000000000000a5409ec958c83c3f309868babaca7c86dcb077c1
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000009
Arg [5] : 42726f74636861696e0000000000000000000000000000000000000000000000
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [7] : 42524f5400000000000000000000000000000000000000000000000000000000


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

OVERVIEW

Brotchain is generative NFT art with bitmaps generated and rendered entirely by a blockchain contract. No externalities, no rendering dependencies—just 100% Solidity.

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.