ETH Price: $3,435.18 (-1.40%)

Contract

0x08d84A6cd9523Ddc7a16F94D004Db985C3406a70
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Transfer Ownersh...166382502023-02-16 2:15:35679 days ago1676513735IN
0x08d84A6c...5C3406a70
0 ETH0.0011389639.84346062
Add Skills166382492023-02-16 2:15:23679 days ago1676513723IN
0x08d84A6c...5C3406a70
0 ETH0.081901739.33583954
Add Glasses166382482023-02-16 2:15:11679 days ago1676513711IN
0x08d84A6c...5C3406a70
0 ETH0.0273689539.96039273
Add Heads166382472023-02-16 2:14:59679 days ago1676513699IN
0x08d84A6c...5C3406a70
0 ETH0.1412092238.7435798
Add Bodies166382462023-02-16 2:14:47679 days ago1676513687IN
0x08d84A6c...5C3406a70
0 ETH0.0471115639.43908544
Set Palette166382452023-02-16 2:14:35679 days ago1676513675IN
0x08d84A6c...5C3406a70
0 ETH0.0095995939.71039902
Add Many Backgro...166382442023-02-16 2:14:23679 days ago1676513663IN
0x08d84A6c...5C3406a70
0 ETH0.0043004941.06658766

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
NounsDescriptorV2

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 10000 runs

Other Settings:
default evmVersion
File 1 of 13 : NounsDescriptorV2.sol
// SPDX-License-Identifier: GPL-3.0

/// @title The CNNouns NFT descriptor

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

pragma solidity ^0.8.6;

// LICENSE
// This file is a modified version of nounsDAO's NounsDescriptorV2.sol:
// https://github.com/nounsDAO/nouns-monorepo/blob/854b9b64770401da71503972c65c4f9eda060ba6/packages/nouns-contracts/contracts/NounsDescriptorV2.sol
//
// NounsDescriptorV2.sol licensed under the GPL-3.0 license.
// With modifications by CNNouns DAO.

import { Ownable } from '@openzeppelin/contracts/access/Ownable.sol';
import { Strings } from '@openzeppelin/contracts/utils/Strings.sol';
import { INounsDescriptorV2 } from './interfaces/INounsDescriptorV2.sol';
import { INounsSeeder } from './interfaces/INounsSeeder.sol';
import { NFTDescriptorV2 } from './libs/NFTDescriptorV2.sol';
import { ISVGRenderer } from './interfaces/ISVGRenderer.sol';
import { INounsArt } from './interfaces/INounsArt.sol';
import { IInflator } from './interfaces/IInflator.sol';

contract NounsDescriptorV2 is INounsDescriptorV2, Ownable {
    using Strings for uint256;

    // prettier-ignore
    // https://creativecommons.org/publicdomain/zero/1.0/legalcode.txt
    bytes32 constant COPYRIGHT_CC0_1_0_UNIVERSAL_LICENSE = 0xa2010f343487d3f7618affe54f789f5487602331c0a8d03f49e9a7c547cf0499;

    /// @notice The contract responsible for holding compressed Noun art
    INounsArt public art;

    /// @notice The contract responsible for constructing SVGs
    ISVGRenderer public renderer;

    /// @notice Whether or not new Noun parts can be added
    bool public override arePartsLocked;

    /// @notice Whether or not `tokenURI` should be returned as a data URI (Default: true)
    bool public override isDataURIEnabled = true;

    /// @notice Base URI, used when isDataURIEnabled is false
    string public override baseURI;

    /**
     * @notice Require that the parts have not been locked.
     */
    modifier whenPartsNotLocked() {
        require(!arePartsLocked, 'Parts are locked');
        _;
    }

    constructor(INounsArt _art, ISVGRenderer _renderer) {
        art = _art;
        renderer = _renderer;
    }

    /**
     * @notice Set the Noun's art contract.
     * @dev Only callable by the owner when not locked.
     */
    function setArt(INounsArt _art) external onlyOwner whenPartsNotLocked {
        art = _art;

        emit ArtUpdated(_art);
    }

    /**
     * @notice Set the SVG renderer.
     * @dev Only callable by the owner.
     */
    function setRenderer(ISVGRenderer _renderer) external onlyOwner {
        renderer = _renderer;

        emit RendererUpdated(_renderer);
    }

    /**
     * @notice Set the art contract's `descriptor`.
     * @param descriptor the address to set.
     * @dev Only callable by the owner.
     */
    function setArtDescriptor(address descriptor) external onlyOwner {
        art.setDescriptor(descriptor);
    }

    /**
     * @notice Set the art contract's `inflator`.
     * @param inflator the address to set.
     * @dev Only callable by the owner.
     */
    function setArtInflator(IInflator inflator) external onlyOwner {
        art.setInflator(inflator);
    }

    /**
     * @notice Get the number of available Noun `backgrounds`.
     */
    function backgroundCount() external view override returns (uint256) {
        return art.backgroundsCount();
    }

    /**
     * @notice Get the number of available Noun `bodies`.
     */
    function bodyCount() external view override returns (uint256) {
        return art.getBodiesTrait().storedImagesCount;
    }

    /**
     * @notice Get the number of available Noun `heads`.
     */
    function headCount() external view override returns (uint256) {
        return art.getHeadsTrait().storedImagesCount;
    }

    /**
     * @notice Get the number of available Noun `glasses`.
     */
    function glassesCount() external view override returns (uint256) {
        return art.getGlassesTrait().storedImagesCount;
    }

    /**
     * @notice Get the number of available Noun `skills`.
     */
    function skillCount() external view override returns (uint256) {
        return art.getSkillsTrait().storedImagesCount;
    }

    /**
     * @notice Batch add Noun backgrounds.
     * @dev This function can only be called by the owner when not locked.
     */
    function addManyBackgrounds(string[] calldata _backgrounds) external override onlyOwner whenPartsNotLocked {
        art.addManyBackgrounds(_backgrounds);
    }

    /**
     * @notice Add a Noun background.
     * @dev This function can only be called by the owner when not locked.
     */
    function addBackground(string calldata _background) external override onlyOwner whenPartsNotLocked {
        art.addBackground(_background);
    }

    /**
     * @notice Update a single color palette. This function can be used to
     * add a new color palette or update an existing palette.
     * @param paletteIndex the identifier of this palette
     * @param palette byte array of colors. every 3 bytes represent an RGB color. max length: 256 * 3 = 768
     * @dev This function can only be called by the owner when not locked.
     */
    function setPalette(uint8 paletteIndex, bytes calldata palette) external override onlyOwner whenPartsNotLocked {
        art.setPalette(paletteIndex, palette);
    }

    /**
     * @notice Add a batch of body images.
     * @param encodedCompressed bytes created by taking a string array of RLE-encoded images, abi encoding it as a bytes array,
     * and finally compressing it using deflate.
     * @param decompressedLength the size in bytes the images bytes were prior to compression; required input for Inflate.
     * @param imageCount the number of images in this batch; used when searching for images among batches.
     * @dev This function can only be called by the owner when not locked.
     */
    function addBodies(
        bytes calldata encodedCompressed,
        uint80 decompressedLength,
        uint16 imageCount
    ) external override onlyOwner whenPartsNotLocked {
        art.addBodies(encodedCompressed, decompressedLength, imageCount);
    }

    /**
     * @notice Add a batch of head images.
     * @param encodedCompressed bytes created by taking a string array of RLE-encoded images, abi encoding it as a bytes array,
     * and finally compressing it using deflate.
     * @param decompressedLength the size in bytes the images bytes were prior to compression; required input for Inflate.
     * @param imageCount the number of images in this batch; used when searching for images among batches.
     * @dev This function can only be called by the owner when not locked.
     */
    function addHeads(
        bytes calldata encodedCompressed,
        uint80 decompressedLength,
        uint16 imageCount
    ) external override onlyOwner whenPartsNotLocked {
        art.addHeads(encodedCompressed, decompressedLength, imageCount);
    }

    /**
     * @notice Add a batch of glasses images.
     * @param encodedCompressed bytes created by taking a string array of RLE-encoded images, abi encoding it as a bytes array,
     * and finally compressing it using deflate.
     * @param decompressedLength the size in bytes the images bytes were prior to compression; required input for Inflate.
     * @param imageCount the number of images in this batch; used when searching for images among batches.
     * @dev This function can only be called by the owner when not locked.
     */
    function addGlasses(
        bytes calldata encodedCompressed,
        uint80 decompressedLength,
        uint16 imageCount
    ) external override onlyOwner whenPartsNotLocked {
        art.addGlasses(encodedCompressed, decompressedLength, imageCount);
    }

    /**
     * @notice Add a batch of skill images.
     * @param encodedCompressed bytes created by taking a string array of RLE-encoded images, abi encoding it as a bytes array,
     * and finally compressing it using deflate.
     * @param decompressedLength the size in bytes the images bytes were prior to compression; required input for Inflate.
     * @param imageCount the number of images in this batch; used when searching for images among batches.
     * @dev This function can only be called by the owner when not locked.
     */
    function addSkills(
        bytes calldata encodedCompressed,
        uint80 decompressedLength,
        uint16 imageCount
    ) external override onlyOwner whenPartsNotLocked {
        art.addSkills(encodedCompressed, decompressedLength, imageCount);
    }

    /**
     * @notice Update a single color palette. This function can be used to
     * add a new color palette or update an existing palette. This function does not check for data length validity
     * (len <= 768, len % 3 == 0).
     * @param paletteIndex the identifier of this palette
     * @param pointer the address of the contract holding the palette bytes. every 3 bytes represent an RGB color.
     * max length: 256 * 3 = 768.
     * @dev This function can only be called by the owner when not locked.
     */
    function setPalettePointer(uint8 paletteIndex, address pointer) external override onlyOwner whenPartsNotLocked {
        art.setPalettePointer(paletteIndex, pointer);
    }

    /**
     * @notice Add a batch of body images from an existing storage contract.
     * @param pointer the address of a contract where the image batch was stored using SSTORE2. The data
     * format is expected to be like {encodedCompressed}: bytes created by taking a string array of
     * RLE-encoded images, abi encoding it as a bytes array, and finally compressing it using deflate.
     * @param decompressedLength the size in bytes the images bytes were prior to compression; required input for Inflate.
     * @param imageCount the number of images in this batch; used when searching for images among batches.
     * @dev This function can only be called by the owner when not locked.
     */
    function addBodiesFromPointer(
        address pointer,
        uint80 decompressedLength,
        uint16 imageCount
    ) external override onlyOwner whenPartsNotLocked {
        art.addBodiesFromPointer(pointer, decompressedLength, imageCount);
    }

    /**
     * @notice Add a batch of head images from an existing storage contract.
     * @param pointer the address of a contract where the image batch was stored using SSTORE2. The data
     * format is expected to be like {encodedCompressed}: bytes created by taking a string array of
     * RLE-encoded images, abi encoding it as a bytes array, and finally compressing it using deflate.
     * @param decompressedLength the size in bytes the images bytes were prior to compression; required input for Inflate.
     * @param imageCount the number of images in this batch; used when searching for images among batches.
     * @dev This function can only be called by the owner when not locked.
     */
    function addHeadsFromPointer(
        address pointer,
        uint80 decompressedLength,
        uint16 imageCount
    ) external override onlyOwner whenPartsNotLocked {
        art.addHeadsFromPointer(pointer, decompressedLength, imageCount);
    }

    /**
     * @notice Add a batch of glasses images from an existing storage contract.
     * @param pointer the address of a contract where the image batch was stored using SSTORE2. The data
     * format is expected to be like {encodedCompressed}: bytes created by taking a string array of
     * RLE-encoded images, abi encoding it as a bytes array, and finally compressing it using deflate.
     * @param decompressedLength the size in bytes the images bytes were prior to compression; required input for Inflate.
     * @param imageCount the number of images in this batch; used when searching for images among batches.
     * @dev This function can only be called by the owner when not locked.
     */
    function addGlassesFromPointer(
        address pointer,
        uint80 decompressedLength,
        uint16 imageCount
    ) external override onlyOwner whenPartsNotLocked {
        art.addGlassesFromPointer(pointer, decompressedLength, imageCount);
    }

    /**
     * @notice Add a batch of skill images from an existing storage contract.
     * @param pointer the address of a contract where the image batch was stored using SSTORE2. The data
     * format is expected to be like {encodedCompressed}: bytes created by taking a string array of
     * RLE-encoded images, abi encoding it as a bytes array, and finally compressing it using deflate.
     * @param decompressedLength the size in bytes the images bytes were prior to compression; required input for Inflate.
     * @param imageCount the number of images in this batch; used when searching for images among batches.
     * @dev This function can only be called by the owner when not locked.
     */
    function addSkillsFromPointer(
        address pointer,
        uint80 decompressedLength,
        uint16 imageCount
    ) external override onlyOwner whenPartsNotLocked {
        art.addSkillsFromPointer(pointer, decompressedLength, imageCount);
    }

    /**
     * @notice Get a background color by ID.
     * @param index the index of the background.
     * @return string the RGB hex value of the background.
     */
    function backgrounds(uint256 index) public view override returns (string memory) {
        return art.backgrounds(index);
    }

    /**
     * @notice Get a head image by ID.
     * @param index the index of the head.
     * @return bytes the RLE-encoded bytes of the image.
     */
    function heads(uint256 index) public view override returns (bytes memory) {
        return art.heads(index);
    }

    /**
     * @notice Get a body image by ID.
     * @param index the index of the body.
     * @return bytes the RLE-encoded bytes of the image.
     */
    function bodies(uint256 index) public view override returns (bytes memory) {
        return art.bodies(index);
    }

    /**
     * @notice Get a glasses image by ID.
     * @param index the index of the glasses.
     * @return bytes the RLE-encoded bytes of the image.
     */
    function glasses(uint256 index) public view override returns (bytes memory) {
        return art.glasses(index);
    }

    /**
     * @notice Get an skill image by ID.
     * @param index the index of the skill.
     * @return bytes the RLE-encoded bytes of the image.
     */
    function skills(uint256 index) public view override returns (bytes memory) {
        return art.skills(index);
    }

    /**
     * @notice Get a color palette by ID.
     * @param index the index of the palette.
     * @return bytes the palette bytes, where every 3 consecutive bytes represent a color in RGB format.
     */
    function palettes(uint8 index) public view override returns (bytes memory) {
        return art.palettes(index);
    }

    /**
     * @notice Lock all Noun parts.
     * @dev This cannot be reversed and can only be called by the owner when not locked.
     */
    function lockParts() external override onlyOwner whenPartsNotLocked {
        arePartsLocked = true;

        emit PartsLocked();
    }

    /**
     * @notice Toggle a boolean value which determines if `tokenURI` returns a data URI
     * or an HTTP URL.
     * @dev This can only be called by the owner.
     */
    function toggleDataURIEnabled() external override onlyOwner {
        bool enabled = !isDataURIEnabled;

        isDataURIEnabled = enabled;
        emit DataURIToggled(enabled);
    }

    /**
     * @notice Set the base URI for all token IDs. It is automatically
     * added as a prefix to the value returned in {tokenURI}, or to the
     * token ID if {tokenURI} is empty.
     * @dev This can only be called by the owner.
     */
    function setBaseURI(string calldata _baseURI) external override onlyOwner {
        baseURI = _baseURI;

        emit BaseURIUpdated(_baseURI);
    }

    /**
     * @notice Given a token ID and seed, construct a token URI for an official CNNouns DAO noun.
     * @dev The returned value may be a base64 encoded data URI or an API URL.
     */
    function tokenURI(uint256 tokenId, INounsSeeder.Seed memory seed) external view override returns (string memory) {
        if (isDataURIEnabled) {
            return dataURI(tokenId, seed);
        }
        return string(abi.encodePacked(baseURI, tokenId.toString()));
    }

    /**
     * @notice Given a token ID and seed, construct a base64 encoded data URI for an official CNNouns DAO noun.
     */
    function dataURI(uint256 tokenId, INounsSeeder.Seed memory seed) public view override returns (string memory) {
        string memory nounId = tokenId.toString();
        string memory name = string(abi.encodePacked('CNNoun ', nounId));
        string memory description = string(abi.encodePacked('CNNoun ', nounId, ' is a member of the CNNouns DAO'));

        return genericDataURI(name, description, seed);
    }

    /**
     * @notice Given a name, description, and seed, construct a base64 encoded data URI.
     */
    function genericDataURI(
        string memory name,
        string memory description,
        INounsSeeder.Seed memory seed
    ) public view override returns (string memory) {
        NFTDescriptorV2.TokenURIParams memory params = NFTDescriptorV2.TokenURIParams({
            name: name,
            description: description,
            parts: getPartsForSeed(seed),
            background: art.backgrounds(seed.background)
        });
        return NFTDescriptorV2.constructTokenURI(renderer, params);
    }

    /**
     * @notice Given a seed, construct a base64 encoded SVG image.
     */
    function generateSVGImage(INounsSeeder.Seed memory seed) external view override returns (string memory) {
        ISVGRenderer.SVGParams memory params = ISVGRenderer.SVGParams({
            parts: getPartsForSeed(seed),
            background: art.backgrounds(seed.background)
        });
        return NFTDescriptorV2.generateSVGImage(renderer, params);
    }

    /**
     * @notice Get all Noun parts for the passed `seed`.
     */
    function getPartsForSeed(INounsSeeder.Seed memory seed) public view returns (ISVGRenderer.Part[] memory) {
        bytes memory body = art.bodies(seed.body);
        bytes memory head = art.heads(seed.head);
        bytes memory glasses_ = art.glasses(seed.glasses);
        bytes memory skill = art.skills(seed.skill);

        ISVGRenderer.Part[] memory parts = new ISVGRenderer.Part[](4);
        parts[0] = ISVGRenderer.Part({ image: body, palette: _getPalette(body) });
        parts[1] = ISVGRenderer.Part({ image: head, palette: _getPalette(head) });
        parts[2] = ISVGRenderer.Part({ image: glasses_, palette: _getPalette(glasses_) });
        parts[3] = ISVGRenderer.Part({ image: skill, palette: _getPalette(skill) });
        return parts;
    }

    /**
     * @notice Get the color palette pointer for the passed part.
     */
    function _getPalette(bytes memory part) private view returns (bytes memory) {
        return art.palettes(uint8(part[0]));
    }
}

File 2 of 13 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

File 3 of 13 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Strings.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

File 4 of 13 : INounsDescriptorV2.sol
// SPDX-License-Identifier: GPL-3.0

/// @title Interface for NounsDescriptorV2

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

pragma solidity ^0.8.6;

// LICENSE
// This file is a modified version of nounsDAO's INounsDescriptorV2.sol:
// https://github.com/nounsDAO/nouns-monorepo/blob/854b9b64770401da71503972c65c4f9eda060ba6/packages/nouns-contracts/contracts/interfaces/INounsDescriptorV2.sol
//
// INounsDescriptorV2.sol licensed under the GPL-3.0 license.
// With modifications by CNNouns DAO.

import { INounsSeeder } from './INounsSeeder.sol';
import { ISVGRenderer } from './ISVGRenderer.sol';
import { INounsArt } from './INounsArt.sol';
import { INounsDescriptorMinimal } from './INounsDescriptorMinimal.sol';

interface INounsDescriptorV2 is INounsDescriptorMinimal {
    event PartsLocked();

    event DataURIToggled(bool enabled);

    event BaseURIUpdated(string baseURI);

    event ArtUpdated(INounsArt art);

    event RendererUpdated(ISVGRenderer renderer);

    error EmptyPalette();
    error BadPaletteLength();
    error IndexNotFound();

    function arePartsLocked() external returns (bool);

    function isDataURIEnabled() external returns (bool);

    function baseURI() external returns (string memory);

    function palettes(uint8 paletteIndex) external view returns (bytes memory);

    function backgrounds(uint256 index) external view returns (string memory);

    function bodies(uint256 index) external view returns (bytes memory);

    function heads(uint256 index) external view returns (bytes memory);

    function glasses(uint256 index) external view returns (bytes memory);

    function skills(uint256 index) external view returns (bytes memory);

    function backgroundCount() external view override returns (uint256);

    function bodyCount() external view override returns (uint256);

    function headCount() external view override returns (uint256);

    function glassesCount() external view override returns (uint256);

    function skillCount() external view override returns (uint256);

    function addManyBackgrounds(string[] calldata backgrounds) external;

    function addBackground(string calldata background) external;

    function setPalette(uint8 paletteIndex, bytes calldata palette) external;

    function addBodies(
        bytes calldata encodedCompressed,
        uint80 decompressedLength,
        uint16 imageCount
    ) external;

    function addHeads(
        bytes calldata encodedCompressed,
        uint80 decompressedLength,
        uint16 imageCount
    ) external;

    function addGlasses(
        bytes calldata encodedCompressed,
        uint80 decompressedLength,
        uint16 imageCount
    ) external;

    function addSkills(
        bytes calldata encodedCompressed,
        uint80 decompressedLength,
        uint16 imageCount
    ) external;

    function setPalettePointer(uint8 paletteIndex, address pointer) external;

    function addBodiesFromPointer(
        address pointer,
        uint80 decompressedLength,
        uint16 imageCount
    ) external;

    function addHeadsFromPointer(
        address pointer,
        uint80 decompressedLength,
        uint16 imageCount
    ) external;

    function addGlassesFromPointer(
        address pointer,
        uint80 decompressedLength,
        uint16 imageCount
    ) external;

    function addSkillsFromPointer(
        address pointer,
        uint80 decompressedLength,
        uint16 imageCount
    ) external;

    function lockParts() external;

    function toggleDataURIEnabled() external;

    function setBaseURI(string calldata baseURI) external;

    function tokenURI(uint256 tokenId, INounsSeeder.Seed memory seed) external view override returns (string memory);

    function dataURI(uint256 tokenId, INounsSeeder.Seed memory seed) external view override returns (string memory);

    function genericDataURI(
        string calldata name,
        string calldata description,
        INounsSeeder.Seed memory seed
    ) external view returns (string memory);

    function generateSVGImage(INounsSeeder.Seed memory seed) external view returns (string memory);
}

File 5 of 13 : INounsSeeder.sol
// SPDX-License-Identifier: GPL-3.0

/// @title Interface for NounsSeeder

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

pragma solidity ^0.8.6;

// LICENSE
// This file is a modified version of nounsDAO's INounsSeeder.sol:
// https://github.com/nounsDAO/nouns-monorepo/blob/854b9b64770401da71503972c65c4f9eda060ba6/packages/nouns-contracts/contracts/interfaces/INounsSeeder.sol
//
// INounsSeeder.sol licensed under the GPL-3.0 license.
// With modifications by CNNouns DAO.

import { INounsDescriptorMinimal } from './INounsDescriptorMinimal.sol';

interface INounsSeeder {
    struct Seed {
        uint48 background;
        uint48 body;
        uint48 head;
        uint48 glasses;
        uint48 skill;
    }

    function generateSeed(uint256 nounId, INounsDescriptorMinimal descriptor) external view returns (Seed memory);
}

File 6 of 13 : NFTDescriptorV2.sol
// SPDX-License-Identifier: GPL-3.0

/// @title A library used to construct ERC721 token URIs and SVG images

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

pragma solidity ^0.8.6;

import { Base64 } from 'base64-sol/base64.sol';
import { ISVGRenderer } from '../interfaces/ISVGRenderer.sol';

library NFTDescriptorV2 {
    struct TokenURIParams {
        string name;
        string description;
        string background;
        ISVGRenderer.Part[] parts;
    }

    /**
     * @notice Construct an ERC721 token URI.
     */
    function constructTokenURI(ISVGRenderer renderer, TokenURIParams memory params)
        public
        view
        returns (string memory)
    {
        string memory image = generateSVGImage(
            renderer,
            ISVGRenderer.SVGParams({ parts: params.parts, background: params.background })
        );

        // prettier-ignore
        return string(
            abi.encodePacked(
                'data:application/json;base64,',
                Base64.encode(
                    bytes(
                        abi.encodePacked('{"name":"', params.name, '", "description":"', params.description, '", "image": "', 'data:image/svg+xml;base64,', image, '"}')
                    )
                )
            )
        );
    }

    /**
     * @notice Generate an SVG image for use in the ERC721 token URI.
     */
    function generateSVGImage(ISVGRenderer renderer, ISVGRenderer.SVGParams memory params)
        public
        view
        returns (string memory svg)
    {
        return Base64.encode(bytes(renderer.generateSVG(params)));
    }
}

File 7 of 13 : ISVGRenderer.sol
// SPDX-License-Identifier: GPL-3.0

/// @title Interface for SVGRenderer

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

pragma solidity ^0.8.6;

interface ISVGRenderer {
    struct Part {
        bytes image;
        bytes palette;
    }

    struct SVGParams {
        Part[] parts;
        string background;
    }

    function generateSVG(SVGParams memory params) external view returns (string memory svg);

    function generateSVGPart(Part memory part) external view returns (string memory partialSVG);

    function generateSVGParts(Part[] memory parts) external view returns (string memory partialSVG);
}

File 8 of 13 : INounsArt.sol
// SPDX-License-Identifier: GPL-3.0

/// @title Interface for NounsArt

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

pragma solidity ^0.8.6;

// LICENSE
// This file is a modified version of nounsDAO's INounsArt.sol:
// https://github.com/nounsDAO/nouns-monorepo/blob/854b9b64770401da71503972c65c4f9eda060ba6/packages/nouns-contracts/contracts/interfaces/INounsArt.sol
//
// INounsArt.sol licensed under the GPL-3.0 license.
// With modifications by CNNouns DAO.

import { Inflate } from '../libs/Inflate.sol';
import { IInflator } from './IInflator.sol';

interface INounsArt {
    error SenderIsNotDescriptor();

    error EmptyPalette();

    error BadPaletteLength();

    error EmptyBytes();

    error BadDecompressedLength();

    error BadImageCount();

    error ImageNotFound();

    error PaletteNotFound();

    event DescriptorUpdated(address oldDescriptor, address newDescriptor);

    event InflatorUpdated(address oldInflator, address newInflator);

    event BackgroundsAdded(uint256 count);

    event PaletteSet(uint8 paletteIndex);

    event BodiesAdded(uint16 count);

    event HeadsAdded(uint16 count);

    event GlassesAdded(uint16 count);

    event SkillsAdded(uint16 count);

    struct NounArtStoragePage {
        uint16 imageCount;
        uint80 decompressedLength;
        address pointer;
    }

    struct Trait {
        NounArtStoragePage[] storagePages;
        uint256 storedImagesCount;
    }

    function descriptor() external view returns (address);

    function inflator() external view returns (IInflator);

    function setDescriptor(address descriptor) external;

    function setInflator(IInflator inflator) external;

    function addManyBackgrounds(string[] calldata _backgrounds) external;

    function addBackground(string calldata _background) external;

    function palettes(uint8 paletteIndex) external view returns (bytes memory);

    function setPalette(uint8 paletteIndex, bytes calldata palette) external;

    function addBodies(
        bytes calldata encodedCompressed,
        uint80 decompressedLength,
        uint16 imageCount
    ) external;

    function addHeads(
        bytes calldata encodedCompressed,
        uint80 decompressedLength,
        uint16 imageCount
    ) external;

    function addGlasses(
        bytes calldata encodedCompressed,
        uint80 decompressedLength,
        uint16 imageCount
    ) external;

    function addSkills(
        bytes calldata encodedCompressed,
        uint80 decompressedLength,
        uint16 imageCount
    ) external;

    function addBodiesFromPointer(
        address pointer,
        uint80 decompressedLength,
        uint16 imageCount
    ) external;

    function setPalettePointer(uint8 paletteIndex, address pointer) external;

    function addHeadsFromPointer(
        address pointer,
        uint80 decompressedLength,
        uint16 imageCount
    ) external;

    function addGlassesFromPointer(
        address pointer,
        uint80 decompressedLength,
        uint16 imageCount
    ) external;

    function addSkillsFromPointer(
        address pointer,
        uint80 decompressedLength,
        uint16 imageCount
    ) external;

    function backgroundsCount() external view returns (uint256);

    function backgrounds(uint256 index) external view returns (string memory);

    function heads(uint256 index) external view returns (bytes memory);

    function bodies(uint256 index) external view returns (bytes memory);

    function glasses(uint256 index) external view returns (bytes memory);

    function skills(uint256 index) external view returns (bytes memory);

    function getBodiesTrait() external view returns (Trait memory);

    function getHeadsTrait() external view returns (Trait memory);

    function getGlassesTrait() external view returns (Trait memory);

    function getSkillsTrait() external view returns (Trait memory);
}

File 9 of 13 : IInflator.sol
// SPDX-License-Identifier: GPL-3.0

/// @title Interface for Inflator

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

pragma solidity ^0.8.6;

import { Inflate } from '../libs/Inflate.sol';

interface IInflator {
    function puff(bytes memory source, uint256 destlen) external pure returns (Inflate.ErrorCode, bytes memory);
}

File 10 of 13 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

File 11 of 13 : INounsDescriptorMinimal.sol
// SPDX-License-Identifier: GPL-3.0

/// @title Common interface for NounsDescriptor versions, as used by NounsToken and NounsSeeder.

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

pragma solidity ^0.8.6;

// LICENSE
// This file is a modified version of nounsDAO's INounsDescriptorMinimal.sol:
// https://github.com/nounsDAO/nouns-monorepo/blob/854b9b64770401da71503972c65c4f9eda060ba6/packages/nouns-contracts/contracts/interfaces/INounsDescriptorMinimal.sol
//
// INounsDescriptorMinimal.sol licensed under the GPL-3.0 license.
// With modifications by CNNouns DAO.

import { INounsSeeder } from './INounsSeeder.sol';

interface INounsDescriptorMinimal {
    ///
    /// USED BY TOKEN
    ///

    function tokenURI(uint256 tokenId, INounsSeeder.Seed memory seed) external view returns (string memory);

    function dataURI(uint256 tokenId, INounsSeeder.Seed memory seed) external view returns (string memory);

    ///
    /// USED BY SEEDER
    ///

    function backgroundCount() external view returns (uint256);

    function bodyCount() external view returns (uint256);

    function headCount() external view returns (uint256);

    function glassesCount() external view returns (uint256);

    function skillCount() external view returns (uint256);
}

File 12 of 13 : Inflate.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity >=0.8.0 <0.9.0;

/// @notice Based on https://github.com/madler/zlib/blob/master/contrib/puff
/// @dev Modified the original code for gas optimizations
/// 1. Disable overflow/underflow checks
/// 2. Chunk some loop iterations
library Inflate {
    // Maximum bits in a code
    uint256 constant MAXBITS = 15;
    // Maximum number of literal/length codes
    uint256 constant MAXLCODES = 286;
    // Maximum number of distance codes
    uint256 constant MAXDCODES = 30;
    // Maximum codes lengths to read
    uint256 constant MAXCODES = (MAXLCODES + MAXDCODES);
    // Number of fixed literal/length codes
    uint256 constant FIXLCODES = 288;

    // Error codes
    enum ErrorCode {
        ERR_NONE, // 0 successful inflate
        ERR_NOT_TERMINATED, // 1 available inflate data did not terminate
        ERR_OUTPUT_EXHAUSTED, // 2 output space exhausted before completing inflate
        ERR_INVALID_BLOCK_TYPE, // 3 invalid block type (type == 3)
        ERR_STORED_LENGTH_NO_MATCH, // 4 stored block length did not match one's complement
        ERR_TOO_MANY_LENGTH_OR_DISTANCE_CODES, // 5 dynamic block code description: too many length or distance codes
        ERR_CODE_LENGTHS_CODES_INCOMPLETE, // 6 dynamic block code description: code lengths codes incomplete
        ERR_REPEAT_NO_FIRST_LENGTH, // 7 dynamic block code description: repeat lengths with no first length
        ERR_REPEAT_MORE, // 8 dynamic block code description: repeat more than specified lengths
        ERR_INVALID_LITERAL_LENGTH_CODE_LENGTHS, // 9 dynamic block code description: invalid literal/length code lengths
        ERR_INVALID_DISTANCE_CODE_LENGTHS, // 10 dynamic block code description: invalid distance code lengths
        ERR_MISSING_END_OF_BLOCK, // 11 dynamic block code description: missing end-of-block code
        ERR_INVALID_LENGTH_OR_DISTANCE_CODE, // 12 invalid literal/length or distance code in fixed or dynamic block
        ERR_DISTANCE_TOO_FAR, // 13 distance is too far back in fixed or dynamic block
        ERR_CONSTRUCT // 14 internal: error in construct()
    }

    // Input and output state
    struct State {
        //////////////////
        // Output state //
        //////////////////
        // Output buffer
        bytes output;
        // Bytes written to out so far
        uint256 outcnt;
        /////////////////
        // Input state //
        /////////////////
        // Input buffer
        bytes input;
        // Bytes read so far
        uint256 incnt;
        ////////////////
        // Temp state //
        ////////////////
        // Bit buffer
        uint256 bitbuf;
        // Number of bits in bit buffer
        uint256 bitcnt;
        //////////////////////////
        // Static Huffman codes //
        //////////////////////////
        Huffman lencode;
        Huffman distcode;
    }

    // Huffman code decoding tables
    struct Huffman {
        uint256[] counts;
        uint256[] symbols;
    }

    function bits(State memory s, uint256 need) private pure returns (ErrorCode, uint256) {
        unchecked {
            // Bit accumulator (can use up to 20 bits)
            uint256 val;

            // Load at least need bits into val
            val = s.bitbuf;
            while (s.bitcnt < need) {
                if (s.incnt == s.input.length) {
                    // Out of input
                    return (ErrorCode.ERR_NOT_TERMINATED, 0);
                }

                // Load eight bits
                val |= uint256(uint8(s.input[s.incnt++])) << s.bitcnt;
                s.bitcnt += 8;
            }

            // Drop need bits and update buffer, always zero to seven bits left
            s.bitbuf = val >> need;
            s.bitcnt -= need;

            // Return need bits, zeroing the bits above that
            uint256 ret = (val & ((1 << need) - 1));
            return (ErrorCode.ERR_NONE, ret);
        }
    }

    function _stored(State memory s) private pure returns (ErrorCode) {
        unchecked {
            // Length of stored block
            uint256 len;

            // Discard leftover bits from current byte (assumes s.bitcnt < 8)
            s.bitbuf = 0;
            s.bitcnt = 0;

            // Get length and check against its one's complement
            if (s.incnt + 4 > s.input.length) {
                // Not enough input
                return ErrorCode.ERR_NOT_TERMINATED;
            }
            len = uint256(uint8(s.input[s.incnt++]));
            len |= uint256(uint8(s.input[s.incnt++])) << 8;

            if (uint8(s.input[s.incnt++]) != (~len & 0xFF) || uint8(s.input[s.incnt++]) != ((~len >> 8) & 0xFF)) {
                // Didn't match complement!
                return ErrorCode.ERR_STORED_LENGTH_NO_MATCH;
            }

            // Copy len bytes from in to out
            if (s.incnt + len > s.input.length) {
                // Not enough input
                return ErrorCode.ERR_NOT_TERMINATED;
            }
            if (s.outcnt + len > s.output.length) {
                // Not enough output space
                return ErrorCode.ERR_OUTPUT_EXHAUSTED;
            }
            while (len != 0) {
                // Note: Solidity reverts on underflow, so we decrement here
                len -= 1;
                s.output[s.outcnt++] = s.input[s.incnt++];
            }

            // Done with a valid stored block
            return ErrorCode.ERR_NONE;
        }
    }

    function _decode(State memory s, Huffman memory h) private pure returns (ErrorCode, uint256) {
        unchecked {
            // Current number of bits in code
            uint256 len;
            // Len bits being decoded
            uint256 code = 0;
            // First code of length len
            uint256 first = 0;
            // Number of codes of length len
            uint256 count;
            // Index of first code of length len in symbol table
            uint256 index = 0;
            // Error code
            ErrorCode err;

            uint256 tempCode;
            for (len = 1; len <= MAXBITS; len += 5) {
                // Get next bit
                (err, tempCode) = bits(s, 1);
                if (err != ErrorCode.ERR_NONE) {
                    return (err, 0);
                }
                code |= tempCode;
                count = h.counts[len];

                // If length len, return symbol
                if (code < first + count) {
                    return (ErrorCode.ERR_NONE, h.symbols[index + (code - first)]);
                }
                // Else update for next length
                index += count;
                first += count;
                first <<= 1;
                code <<= 1;

                // Get next bit
                (err, tempCode) = bits(s, 1);
                if (err != ErrorCode.ERR_NONE) {
                    return (err, 0);
                }
                code |= tempCode;
                count = h.counts[len + 1];

                // If length len, return symbol
                if (code < first + count) {
                    return (ErrorCode.ERR_NONE, h.symbols[index + (code - first)]);
                }
                // Else update for next length
                index += count;
                first += count;
                first <<= 1;
                code <<= 1;

                // Get next bit
                (err, tempCode) = bits(s, 1);
                if (err != ErrorCode.ERR_NONE) {
                    return (err, 0);
                }
                code |= tempCode;
                count = h.counts[len + 2];

                // If length len, return symbol
                if (code < first + count) {
                    return (ErrorCode.ERR_NONE, h.symbols[index + (code - first)]);
                }
                // Else update for next length
                index += count;
                first += count;
                first <<= 1;
                code <<= 1;

                // Get next bit
                (err, tempCode) = bits(s, 1);
                if (err != ErrorCode.ERR_NONE) {
                    return (err, 0);
                }
                code |= tempCode;
                count = h.counts[len + 3];

                // If length len, return symbol
                if (code < first + count) {
                    return (ErrorCode.ERR_NONE, h.symbols[index + (code - first)]);
                }
                // Else update for next length
                index += count;
                first += count;
                first <<= 1;
                code <<= 1;

                // Get next bit
                (err, tempCode) = bits(s, 1);
                if (err != ErrorCode.ERR_NONE) {
                    return (err, 0);
                }
                code |= tempCode;
                count = h.counts[len + 4];

                // If length len, return symbol
                if (code < first + count) {
                    return (ErrorCode.ERR_NONE, h.symbols[index + (code - first)]);
                }
                // Else update for next length
                index += count;
                first += count;
                first <<= 1;
                code <<= 1;
            }

            // Ran out of codes
            return (ErrorCode.ERR_INVALID_LENGTH_OR_DISTANCE_CODE, 0);
        }
    }

    function _construct(
        Huffman memory h,
        uint256[] memory lengths,
        uint256 n,
        uint256 start
    ) private pure returns (ErrorCode) {
        unchecked {
            // Current symbol when stepping through lengths[]
            uint256 symbol;
            // Current length when stepping through h.counts[]
            uint256 len;
            // Number of possible codes left of current length
            uint256 left;
            // Offsets in symbol table for each length
            uint256[MAXBITS + 1] memory offs;

            // Count number of codes of each length
            for (len = 0; len <= MAXBITS; ++len) {
                h.counts[len] = 0;
            }
            for (symbol = 0; symbol < n; ++symbol) {
                // Assumes lengths are within bounds
                ++h.counts[lengths[start + symbol]];
            }
            // No codes!
            if (h.counts[0] == n) {
                // Complete, but decode() will fail
                return (ErrorCode.ERR_NONE);
            }

            // Check for an over-subscribed or incomplete set of lengths

            // One possible code of zero length
            left = 1;

            for (len = 1; len <= MAXBITS; len += 5) {
                // One more bit, double codes left
                left <<= 1;
                if (left < h.counts[len]) {
                    // Over-subscribed--return error
                    return ErrorCode.ERR_CONSTRUCT;
                }
                // Deduct count from possible codes
                left -= h.counts[len];

                // One more bit, double codes left
                left <<= 1;
                if (left < h.counts[len + 1]) {
                    // Over-subscribed--return error
                    return ErrorCode.ERR_CONSTRUCT;
                }
                // Deduct count from possible codes
                left -= h.counts[len + 1];

                // One more bit, double codes left
                left <<= 1;
                if (left < h.counts[len + 2]) {
                    // Over-subscribed--return error
                    return ErrorCode.ERR_CONSTRUCT;
                }
                // Deduct count from possible codes
                left -= h.counts[len + 2];

                // One more bit, double codes left
                left <<= 1;
                if (left < h.counts[len + 3]) {
                    // Over-subscribed--return error
                    return ErrorCode.ERR_CONSTRUCT;
                }
                // Deduct count from possible codes
                left -= h.counts[len + 3];

                // One more bit, double codes left
                left <<= 1;
                if (left < h.counts[len + 4]) {
                    // Over-subscribed--return error
                    return ErrorCode.ERR_CONSTRUCT;
                }
                // Deduct count from possible codes
                left -= h.counts[len + 4];
            }

            // Generate offsets into symbol table for each length for sorting
            offs[1] = 0;
            for (len = 1; len < MAXBITS; ++len) {
                offs[len + 1] = offs[len] + h.counts[len];
            }

            // Put symbols in table sorted by length, by symbol order within each length
            for (symbol = 0; symbol < n; ++symbol) {
                if (lengths[start + symbol] != 0) {
                    h.symbols[offs[lengths[start + symbol]]++] = symbol;
                }
            }

            // Left > 0 means incomplete
            return left > 0 ? ErrorCode.ERR_CONSTRUCT : ErrorCode.ERR_NONE;
        }
    }

    function _codes(
        State memory s,
        Huffman memory lencode,
        Huffman memory distcode
    ) private pure returns (ErrorCode) {
        unchecked {
            // Decoded symbol
            uint256 symbol;
            // Length for copy
            uint256 len;
            // Distance for copy
            uint256 dist;
            // TODO Solidity doesn't support constant arrays, but these are fixed at compile-time
            // Size base for length codes 257..285
            uint16[29] memory lens = [
                3,
                4,
                5,
                6,
                7,
                8,
                9,
                10,
                11,
                13,
                15,
                17,
                19,
                23,
                27,
                31,
                35,
                43,
                51,
                59,
                67,
                83,
                99,
                115,
                131,
                163,
                195,
                227,
                258
            ];
            // Extra bits for length codes 257..285
            uint8[29] memory lext = [
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                0,
                1,
                1,
                1,
                1,
                2,
                2,
                2,
                2,
                3,
                3,
                3,
                3,
                4,
                4,
                4,
                4,
                5,
                5,
                5,
                5,
                0
            ];
            // Offset base for distance codes 0..29
            uint16[30] memory dists = [
                1,
                2,
                3,
                4,
                5,
                7,
                9,
                13,
                17,
                25,
                33,
                49,
                65,
                97,
                129,
                193,
                257,
                385,
                513,
                769,
                1025,
                1537,
                2049,
                3073,
                4097,
                6145,
                8193,
                12289,
                16385,
                24577
            ];
            // Extra bits for distance codes 0..29
            uint8[30] memory dext = [
                0,
                0,
                0,
                0,
                1,
                1,
                2,
                2,
                3,
                3,
                4,
                4,
                5,
                5,
                6,
                6,
                7,
                7,
                8,
                8,
                9,
                9,
                10,
                10,
                11,
                11,
                12,
                12,
                13,
                13
            ];
            // Error code
            ErrorCode err;

            // Decode literals and length/distance pairs
            while (symbol != 256) {
                (err, symbol) = _decode(s, lencode);
                if (err != ErrorCode.ERR_NONE) {
                    // Invalid symbol
                    return err;
                }

                if (symbol < 256) {
                    // Literal: symbol is the byte
                    // Write out the literal
                    if (s.outcnt == s.output.length) {
                        return ErrorCode.ERR_OUTPUT_EXHAUSTED;
                    }
                    s.output[s.outcnt] = bytes1(uint8(symbol));
                    ++s.outcnt;
                } else if (symbol > 256) {
                    uint256 tempBits;
                    // Length
                    // Get and compute length
                    symbol -= 257;
                    if (symbol >= 29) {
                        // Invalid fixed code
                        return ErrorCode.ERR_INVALID_LENGTH_OR_DISTANCE_CODE;
                    }

                    (err, tempBits) = bits(s, lext[symbol]);
                    if (err != ErrorCode.ERR_NONE) {
                        return err;
                    }
                    len = lens[symbol] + tempBits;

                    // Get and check distance
                    (err, symbol) = _decode(s, distcode);
                    if (err != ErrorCode.ERR_NONE) {
                        // Invalid symbol
                        return err;
                    }
                    (err, tempBits) = bits(s, dext[symbol]);
                    if (err != ErrorCode.ERR_NONE) {
                        return err;
                    }
                    dist = dists[symbol] + tempBits;
                    if (dist > s.outcnt) {
                        // Distance too far back
                        return ErrorCode.ERR_DISTANCE_TOO_FAR;
                    }

                    // Copy length bytes from distance bytes back
                    if (s.outcnt + len > s.output.length) {
                        return ErrorCode.ERR_OUTPUT_EXHAUSTED;
                    }
                    while (len != 0) {
                        // Note: Solidity reverts on underflow, so we decrement here
                        len -= 1;
                        s.output[s.outcnt] = s.output[s.outcnt - dist];
                        ++s.outcnt;
                    }
                } else {
                    s.outcnt += len;
                }
            }

            // Done with a valid fixed or dynamic block
            return ErrorCode.ERR_NONE;
        }
    }

    function _build_fixed(State memory s) private pure returns (ErrorCode) {
        unchecked {
            // Build fixed Huffman tables
            // TODO this is all a compile-time constant
            uint256 symbol;
            uint256[] memory lengths = new uint256[](FIXLCODES);

            // Literal/length table
            for (symbol = 0; symbol < 144; ++symbol) {
                lengths[symbol] = 8;
            }
            for (; symbol < 256; ++symbol) {
                lengths[symbol] = 9;
            }
            for (; symbol < 280; ++symbol) {
                lengths[symbol] = 7;
            }
            for (; symbol < FIXLCODES; ++symbol) {
                lengths[symbol] = 8;
            }

            _construct(s.lencode, lengths, FIXLCODES, 0);

            // Distance table
            for (symbol = 0; symbol < MAXDCODES; ++symbol) {
                lengths[symbol] = 5;
            }

            _construct(s.distcode, lengths, MAXDCODES, 0);

            return ErrorCode.ERR_NONE;
        }
    }

    function _fixed(State memory s) private pure returns (ErrorCode) {
        unchecked {
            // Decode data until end-of-block code
            return _codes(s, s.lencode, s.distcode);
        }
    }

    function _build_dynamic_lengths(State memory s) private pure returns (ErrorCode, uint256[] memory) {
        unchecked {
            uint256 ncode;
            // Index of lengths[]
            uint256 index;
            // Descriptor code lengths
            uint256[] memory lengths = new uint256[](MAXCODES);
            // Error code
            ErrorCode err;
            // Permutation of code length codes
            uint8[19] memory order = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];

            (err, ncode) = bits(s, 4);
            if (err != ErrorCode.ERR_NONE) {
                return (err, lengths);
            }
            ncode += 4;

            // Read code length code lengths (really), missing lengths are zero
            for (index = 0; index < ncode; ++index) {
                (err, lengths[order[index]]) = bits(s, 3);
                if (err != ErrorCode.ERR_NONE) {
                    return (err, lengths);
                }
            }
            for (; index < 19; ++index) {
                lengths[order[index]] = 0;
            }

            return (ErrorCode.ERR_NONE, lengths);
        }
    }

    function _build_dynamic(State memory s)
        private
        pure
        returns (
            ErrorCode,
            Huffman memory,
            Huffman memory
        )
    {
        unchecked {
            // Number of lengths in descriptor
            uint256 nlen;
            uint256 ndist;
            // Index of lengths[]
            uint256 index;
            // Error code
            ErrorCode err;
            // Descriptor code lengths
            uint256[] memory lengths = new uint256[](MAXCODES);
            // Length and distance codes
            Huffman memory lencode = Huffman(new uint256[](MAXBITS + 1), new uint256[](MAXLCODES));
            Huffman memory distcode = Huffman(new uint256[](MAXBITS + 1), new uint256[](MAXDCODES));
            uint256 tempBits;

            // Get number of lengths in each table, check lengths
            (err, nlen) = bits(s, 5);
            if (err != ErrorCode.ERR_NONE) {
                return (err, lencode, distcode);
            }
            nlen += 257;
            (err, ndist) = bits(s, 5);
            if (err != ErrorCode.ERR_NONE) {
                return (err, lencode, distcode);
            }
            ndist += 1;

            if (nlen > MAXLCODES || ndist > MAXDCODES) {
                // Bad counts
                return (ErrorCode.ERR_TOO_MANY_LENGTH_OR_DISTANCE_CODES, lencode, distcode);
            }

            (err, lengths) = _build_dynamic_lengths(s);
            if (err != ErrorCode.ERR_NONE) {
                return (err, lencode, distcode);
            }

            // Build huffman table for code lengths codes (use lencode temporarily)
            err = _construct(lencode, lengths, 19, 0);
            if (err != ErrorCode.ERR_NONE) {
                // Require complete code set here
                return (ErrorCode.ERR_CODE_LENGTHS_CODES_INCOMPLETE, lencode, distcode);
            }

            // Read length/literal and distance code length tables
            index = 0;
            while (index < nlen + ndist) {
                // Decoded value
                uint256 symbol;
                // Last length to repeat
                uint256 len;

                (err, symbol) = _decode(s, lencode);
                if (err != ErrorCode.ERR_NONE) {
                    // Invalid symbol
                    return (err, lencode, distcode);
                }

                if (symbol < 16) {
                    // Length in 0..15
                    lengths[index++] = symbol;
                } else {
                    // Repeat instruction
                    // Assume repeating zeros
                    len = 0;
                    if (symbol == 16) {
                        // Repeat last length 3..6 times
                        if (index == 0) {
                            // No last length!
                            return (ErrorCode.ERR_REPEAT_NO_FIRST_LENGTH, lencode, distcode);
                        }
                        // Last length
                        len = lengths[index - 1];
                        (err, tempBits) = bits(s, 2);
                        if (err != ErrorCode.ERR_NONE) {
                            return (err, lencode, distcode);
                        }
                        symbol = 3 + tempBits;
                    } else if (symbol == 17) {
                        // Repeat zero 3..10 times
                        (err, tempBits) = bits(s, 3);
                        if (err != ErrorCode.ERR_NONE) {
                            return (err, lencode, distcode);
                        }
                        symbol = 3 + tempBits;
                    } else {
                        // == 18, repeat zero 11..138 times
                        (err, tempBits) = bits(s, 7);
                        if (err != ErrorCode.ERR_NONE) {
                            return (err, lencode, distcode);
                        }
                        symbol = 11 + tempBits;
                    }

                    if (index + symbol > nlen + ndist) {
                        // Too many lengths!
                        return (ErrorCode.ERR_REPEAT_MORE, lencode, distcode);
                    }
                    while (symbol != 0) {
                        // Note: Solidity reverts on underflow, so we decrement here
                        symbol -= 1;

                        // Repeat last or zero symbol times
                        lengths[index++] = len;
                    }
                }
            }

            // Check for end-of-block code -- there better be one!
            if (lengths[256] == 0) {
                return (ErrorCode.ERR_MISSING_END_OF_BLOCK, lencode, distcode);
            }

            // Build huffman table for literal/length codes
            err = _construct(lencode, lengths, nlen, 0);
            if (
                err != ErrorCode.ERR_NONE &&
                (err == ErrorCode.ERR_NOT_TERMINATED ||
                    err == ErrorCode.ERR_OUTPUT_EXHAUSTED ||
                    nlen != lencode.counts[0] + lencode.counts[1])
            ) {
                // Incomplete code ok only for single length 1 code
                return (ErrorCode.ERR_INVALID_LITERAL_LENGTH_CODE_LENGTHS, lencode, distcode);
            }

            // Build huffman table for distance codes
            err = _construct(distcode, lengths, ndist, nlen);
            if (
                err != ErrorCode.ERR_NONE &&
                (err == ErrorCode.ERR_NOT_TERMINATED ||
                    err == ErrorCode.ERR_OUTPUT_EXHAUSTED ||
                    ndist != distcode.counts[0] + distcode.counts[1])
            ) {
                // Incomplete code ok only for single length 1 code
                return (ErrorCode.ERR_INVALID_DISTANCE_CODE_LENGTHS, lencode, distcode);
            }

            return (ErrorCode.ERR_NONE, lencode, distcode);
        }
    }

    function _dynamic(State memory s) private pure returns (ErrorCode) {
        unchecked {
            // Length and distance codes
            Huffman memory lencode;
            Huffman memory distcode;
            // Error code
            ErrorCode err;

            (err, lencode, distcode) = _build_dynamic(s);
            if (err != ErrorCode.ERR_NONE) {
                return err;
            }

            // Decode data until end-of-block code
            return _codes(s, lencode, distcode);
        }
    }

    function puff(bytes memory source, uint256 destlen) internal pure returns (ErrorCode, bytes memory) {
        unchecked {
            // Input/output state
            State memory s = State(
                new bytes(destlen),
                0,
                source,
                0,
                0,
                0,
                Huffman(new uint256[](MAXBITS + 1), new uint256[](FIXLCODES)),
                Huffman(new uint256[](MAXBITS + 1), new uint256[](MAXDCODES))
            );
            // Temp: last bit
            uint256 last;
            // Temp: block type bit
            uint256 t;
            // Error code
            ErrorCode err;

            // Build fixed Huffman tables
            err = _build_fixed(s);
            if (err != ErrorCode.ERR_NONE) {
                return (err, s.output);
            }

            // Process blocks until last block or error
            while (last == 0) {
                // One if last block
                (err, last) = bits(s, 1);
                if (err != ErrorCode.ERR_NONE) {
                    return (err, s.output);
                }

                // Block type 0..3
                (err, t) = bits(s, 2);
                if (err != ErrorCode.ERR_NONE) {
                    return (err, s.output);
                }

                err = (
                    t == 0
                        ? _stored(s)
                        : (t == 1 ? _fixed(s) : (t == 2 ? _dynamic(s) : ErrorCode.ERR_INVALID_BLOCK_TYPE))
                );
                // type == 3, invalid

                if (err != ErrorCode.ERR_NONE) {
                    // Return with error
                    break;
                }
            }

            return (err, s.output);
        }
    }
}

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

pragma solidity >=0.6.0;

/// @title Base64
/// @author Brecht Devos - <[email protected]>
/// @notice Provides functions for encoding/decoding base64
library Base64 {
    string internal constant TABLE_ENCODE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
    bytes  internal constant TABLE_DECODE = hex"0000000000000000000000000000000000000000000000000000000000000000"
                                            hex"00000000000000000000003e0000003f3435363738393a3b3c3d000000000000"
                                            hex"00000102030405060708090a0b0c0d0e0f101112131415161718190000000000"
                                            hex"001a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132330000000000";

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

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

        // 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) {}
            {
                // read 3 bytes
                dataPtr := add(dataPtr, 3)
                let input := mload(dataPtr)

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

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

        return result;
    }

    function decode(string memory _data) internal pure returns (bytes memory) {
        bytes memory data = bytes(_data);

        if (data.length == 0) return new bytes(0);
        require(data.length % 4 == 0, "invalid base64 decoder input");

        // load the table into memory
        bytes memory table = TABLE_DECODE;

        // every 4 characters represent 3 bytes
        uint256 decodedLen = (data.length / 4) * 3;

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

        assembly {
            // padding with '='
            let lastBytes := mload(add(data, mload(data)))
            if eq(and(lastBytes, 0xFF), 0x3d) {
                decodedLen := sub(decodedLen, 1)
                if eq(and(lastBytes, 0xFFFF), 0x3d3d) {
                    decodedLen := sub(decodedLen, 1)
                }
            }

            // set the actual output length
            mstore(result, decodedLen)

            // 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, 4 characters at a time
            for {} lt(dataPtr, endPtr) {}
            {
               // read 4 characters
               dataPtr := add(dataPtr, 4)
               let input := mload(dataPtr)

               // write 3 bytes
               let output := add(
                   add(
                       shl(18, and(mload(add(tablePtr, and(shr(24, input), 0xFF))), 0xFF)),
                       shl(12, and(mload(add(tablePtr, and(shr(16, input), 0xFF))), 0xFF))),
                   add(
                       shl( 6, and(mload(add(tablePtr, and(shr( 8, input), 0xFF))), 0xFF)),
                               and(mload(add(tablePtr, and(        input , 0xFF))), 0xFF)
                    )
                )
                mstore(resultPtr, shl(232, output))
                resultPtr := add(resultPtr, 3)
            }
        }

        return result;
    }
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 10000
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {
    "contracts/libs/NFTDescriptorV2.sol": {
      "NFTDescriptorV2": "0x1efbce9a5a4add7a85cc4b30416d86e01db2bff5"
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract INounsArt","name":"_art","type":"address"},{"internalType":"contract ISVGRenderer","name":"_renderer","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"BadPaletteLength","type":"error"},{"inputs":[],"name":"EmptyPalette","type":"error"},{"inputs":[],"name":"IndexNotFound","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract INounsArt","name":"art","type":"address"}],"name":"ArtUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"baseURI","type":"string"}],"name":"BaseURIUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"enabled","type":"bool"}],"name":"DataURIToggled","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":[],"name":"PartsLocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract ISVGRenderer","name":"renderer","type":"address"}],"name":"RendererUpdated","type":"event"},{"inputs":[{"internalType":"string","name":"_background","type":"string"}],"name":"addBackground","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"encodedCompressed","type":"bytes"},{"internalType":"uint80","name":"decompressedLength","type":"uint80"},{"internalType":"uint16","name":"imageCount","type":"uint16"}],"name":"addBodies","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"pointer","type":"address"},{"internalType":"uint80","name":"decompressedLength","type":"uint80"},{"internalType":"uint16","name":"imageCount","type":"uint16"}],"name":"addBodiesFromPointer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"encodedCompressed","type":"bytes"},{"internalType":"uint80","name":"decompressedLength","type":"uint80"},{"internalType":"uint16","name":"imageCount","type":"uint16"}],"name":"addGlasses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"pointer","type":"address"},{"internalType":"uint80","name":"decompressedLength","type":"uint80"},{"internalType":"uint16","name":"imageCount","type":"uint16"}],"name":"addGlassesFromPointer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"encodedCompressed","type":"bytes"},{"internalType":"uint80","name":"decompressedLength","type":"uint80"},{"internalType":"uint16","name":"imageCount","type":"uint16"}],"name":"addHeads","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"pointer","type":"address"},{"internalType":"uint80","name":"decompressedLength","type":"uint80"},{"internalType":"uint16","name":"imageCount","type":"uint16"}],"name":"addHeadsFromPointer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string[]","name":"_backgrounds","type":"string[]"}],"name":"addManyBackgrounds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"encodedCompressed","type":"bytes"},{"internalType":"uint80","name":"decompressedLength","type":"uint80"},{"internalType":"uint16","name":"imageCount","type":"uint16"}],"name":"addSkills","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"pointer","type":"address"},{"internalType":"uint80","name":"decompressedLength","type":"uint80"},{"internalType":"uint16","name":"imageCount","type":"uint16"}],"name":"addSkillsFromPointer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"arePartsLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"art","outputs":[{"internalType":"contract INounsArt","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"backgroundCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"backgrounds","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"bodies","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bodyCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"components":[{"internalType":"uint48","name":"background","type":"uint48"},{"internalType":"uint48","name":"body","type":"uint48"},{"internalType":"uint48","name":"head","type":"uint48"},{"internalType":"uint48","name":"glasses","type":"uint48"},{"internalType":"uint48","name":"skill","type":"uint48"}],"internalType":"struct INounsSeeder.Seed","name":"seed","type":"tuple"}],"name":"dataURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint48","name":"background","type":"uint48"},{"internalType":"uint48","name":"body","type":"uint48"},{"internalType":"uint48","name":"head","type":"uint48"},{"internalType":"uint48","name":"glasses","type":"uint48"},{"internalType":"uint48","name":"skill","type":"uint48"}],"internalType":"struct INounsSeeder.Seed","name":"seed","type":"tuple"}],"name":"generateSVGImage","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"description","type":"string"},{"components":[{"internalType":"uint48","name":"background","type":"uint48"},{"internalType":"uint48","name":"body","type":"uint48"},{"internalType":"uint48","name":"head","type":"uint48"},{"internalType":"uint48","name":"glasses","type":"uint48"},{"internalType":"uint48","name":"skill","type":"uint48"}],"internalType":"struct INounsSeeder.Seed","name":"seed","type":"tuple"}],"name":"genericDataURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint48","name":"background","type":"uint48"},{"internalType":"uint48","name":"body","type":"uint48"},{"internalType":"uint48","name":"head","type":"uint48"},{"internalType":"uint48","name":"glasses","type":"uint48"},{"internalType":"uint48","name":"skill","type":"uint48"}],"internalType":"struct INounsSeeder.Seed","name":"seed","type":"tuple"}],"name":"getPartsForSeed","outputs":[{"components":[{"internalType":"bytes","name":"image","type":"bytes"},{"internalType":"bytes","name":"palette","type":"bytes"}],"internalType":"struct ISVGRenderer.Part[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"glasses","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"glassesCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"headCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"heads","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isDataURIEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lockParts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"index","type":"uint8"}],"name":"palettes","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renderer","outputs":[{"internalType":"contract ISVGRenderer","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract INounsArt","name":"_art","type":"address"}],"name":"setArt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"descriptor","type":"address"}],"name":"setArtDescriptor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IInflator","name":"inflator","type":"address"}],"name":"setArtInflator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_baseURI","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"paletteIndex","type":"uint8"},{"internalType":"bytes","name":"palette","type":"bytes"}],"name":"setPalette","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint8","name":"paletteIndex","type":"uint8"},{"internalType":"address","name":"pointer","type":"address"}],"name":"setPalettePointer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ISVGRenderer","name":"_renderer","type":"address"}],"name":"setRenderer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"skillCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"skills","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"toggleDataURIEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"components":[{"internalType":"uint48","name":"background","type":"uint48"},{"internalType":"uint48","name":"body","type":"uint48"},{"internalType":"uint48","name":"head","type":"uint48"},{"internalType":"uint48","name":"glasses","type":"uint48"},{"internalType":"uint48","name":"skill","type":"uint48"}],"internalType":"struct INounsSeeder.Seed","name":"seed","type":"tuple"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60806040526002805460ff60a81b1916600160a81b1790553480156200002457600080fd5b5060405162003a5b38038062003a5b8339810160408190526200004791620000ed565b620000523362000084565b600180546001600160a01b039384166001600160a01b031991821617909155600280549290931691161790556200012c565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0381168114620000ea57600080fd5b50565b600080604083850312156200010157600080fd5b82516200010e81620000d4565b60208401519092506200012181620000d4565b809150509250929050565b61391f806200013c6000396000f3fe608060405234801561001057600080fd5b50600436106102e95760003560e01c8063773b977111610191578063bf61df1b116100e3578063e6b1a3ae11610097578063f2fde38b11610071578063f2fde38b14610601578063f4513a6a14610614578063f51a8f1e1461062757600080fd5b8063e6b1a3ae146105d3578063e79c9ea6146105e6578063eba81806146105f957600080fd5b8063cd2b8250116100c8578063cd2b825014610592578063ce2f4f53146105a5578063dfe8478b146105cb57600080fd5b8063bf61df1b1461056a578063cc2aa0911461058a57600080fd5b806391b7916a11610145578063b82c1b4a1161011f578063b82c1b4a1461053c578063b982d1b914610544578063bc2d45fe1461055757600080fd5b806391b7916a1461050357806394f3df6114610516578063aa5bf7d81461052957600080fd5b80638ada6b0f116101765780638ada6b0f146104cc5780638bd54c06146104df5780638da5cb5b146104f257600080fd5b8063773b97711461048457806387db11bd146104b957600080fd5b80634531c0a81161024a5780635a503f13116101fe5780636c0360eb116101d85780636c0360eb14610461578063715018a61461046957806373ac736b1461047157600080fd5b80635a503f13146104285780635e70664c1461043b578063638ac2701461044e57600080fd5b806350d15fbe1161022f57806350d15fbe146103ef57806355f804b31461040257806356d3163d1461041557600080fd5b80634531c0a8146103d4578063461fc5af146103dc57600080fd5b8063301bd28e116102a15780633cfdafd3116102865780633cfdafd3146103985780634479cef2146103ab57806344cee73c146103c157600080fd5b8063301bd28e1461035a578063353c36a01461038557600080fd5b80631dc9637d116102d25780631dc9637d1461032c5780632a1d07691461033f5780632ea043001461034757600080fd5b8063010ecde7146102ee57806304bde4dd14610303575b600080fd5b6103016102fc3660046129ec565b61063a565b005b610316610311366004612a09565b610715565b6040516103239190612a72565b60405180910390f35b61030161033a366004612aad565b6107a7565b610301610906565b610316610355366004612c50565b610a35565b60015461036d906001600160a01b031681565b6040516001600160a01b039091168152602001610323565b610301610393366004612cb5565b610b99565b6103166103a6366004612d1d565b610ce5565b6103b3610d50565b604051908152602001610323565b6103166103cf366004612a09565b610de3565b6103b3610e2e565b6103016103ea366004612aad565b610eba565b6103166103fd366004612a09565b610fe6565b610301610410366004612d4a565b611031565b6103016104233660046129ec565b6110d6565b610316610436366004612a09565b61119d565b610301610449366004612d4a565b6111e8565b61031661045c366004612d1d565b61132e565b61031661139a565b610301611428565b61030161047f366004612aad565b61148e565b6002546104a99074010000000000000000000000000000000000000000900460ff1681565b6040519015158152602001610323565b6103166104c7366004612e0a565b6115ba565b60025461036d906001600160a01b031681565b6103016104ed366004612e90565b61172c565b6000546001600160a01b031661036d565b610301610511366004612ec7565b611845565b610301610524366004612cb5565b611955565b610301610537366004612cb5565b611a69565b6103b3611b7d565b610316610552366004612a09565b611bdf565b610316610565366004612f3c565b611c2a565b61057d610578366004612c50565b611c77565b6040516103239190612f57565b6103b3612026565b6103016105a0366004612aad565b612088565b6002546104a9907501000000000000000000000000000000000000000000900460ff1681565b6103016121b4565b6103016105e13660046129ec565b61228b565b6103016105f4366004612ffa565b6123b6565b6103b36124c8565b61030161060f3660046129ec565b61252a565b6103016106223660046129ec565b61260c565b610301610635366004612cb5565b6126b1565b6000546001600160a01b031633146106995760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6001546040517f01b9a3970000000000000000000000000000000000000000000000000000000081526001600160a01b038381166004830152909116906301b9a397906024015b600060405180830381600087803b1580156106fa57600080fd5b505af115801561070e573d6000803e3d6000fd5b5050505050565b6001546040517f04bde4dd000000000000000000000000000000000000000000000000000000008152600481018390526060916001600160a01b0316906304bde4dd906024015b600060405180830381865afa158015610779573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526107a1919081019061307d565b92915050565b6000546001600160a01b031633146108015760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b60025474010000000000000000000000000000000000000000900460ff161561086c5760405162461bcd60e51b815260206004820152601060248201527f506172747320617265206c6f636b6564000000000000000000000000000000006044820152606401610690565b6001546040517f1dc9637d0000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015269ffffffffffffffffffff8516602483015261ffff8416604483015290911690631dc9637d906064015b600060405180830381600087803b1580156108e957600080fd5b505af11580156108fd573d6000803e3d6000fd5b50505050505050565b6000546001600160a01b031633146109605760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b60025474010000000000000000000000000000000000000000900460ff16156109cb5760405162461bcd60e51b815260206004820152601060248201527f506172747320617265206c6f636b6564000000000000000000000000000000006044820152606401610690565b600280547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790556040517f1680ee6d421f70ed6030d2fc4fcb50217a5dd617858d56562b119eca59172e5790600090a1565b606060006040518060400160405280610a4d85611c77565b815260015485516040517f04bde4dd00000000000000000000000000000000000000000000000000000000815265ffffffffffff90911660048201526020909201916001600160a01b03909116906304bde4dd90602401600060405180830381865afa158015610ac1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ae9919081019061307d565b90526002546040517f22cc1ad6000000000000000000000000000000000000000000000000000000008152919250731efbce9a5a4add7a85cc4b30416d86e01db2bff5916322cc1ad691610b4d916001600160a01b03909116908590600401613141565b600060405180830381865af4158015610b6a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b92919081019061307d565b9392505050565b6000546001600160a01b03163314610bf35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b60025474010000000000000000000000000000000000000000900460ff1615610c5e5760405162461bcd60e51b815260206004820152601060248201527f506172747320617265206c6f636b6564000000000000000000000000000000006044820152606401610690565b6001546040517f353c36a00000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063353c36a090610cad9087908790879087906004016131d1565b600060405180830381600087803b158015610cc757600080fd5b505af1158015610cdb573d6000803e3d6000fd5b5050505050505050565b6002546060907501000000000000000000000000000000000000000000900460ff1615610d1d57610d16838361132e565b90506107a1565b6003610d28846127c5565b604051602001610d3992919061325f565b604051602081830303815290604052905092915050565b600154604080517fe73dd38300000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163e73dd38391600480830192869291908290030181865afa158015610db2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610dda9190810190613304565b60200151905090565b6001546040517f44cee73c000000000000000000000000000000000000000000000000000000008152600481018390526060916001600160a01b0316906344cee73c9060240161075c565b600154604080517ffd30704b00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163fd30704b9160048083019260209291908290030181865afa158015610e91573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb59190613428565b905090565b6000546001600160a01b03163314610f145760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b60025474010000000000000000000000000000000000000000900460ff1615610f7f5760405162461bcd60e51b815260206004820152601060248201527f506172747320617265206c6f636b6564000000000000000000000000000000006044820152606401610690565b6001546040517f461fc5af0000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015269ffffffffffffffffffff8516602483015261ffff841660448301529091169063461fc5af906064016108cf565b6001546040517f50d15fbe000000000000000000000000000000000000000000000000000000008152600481018390526060916001600160a01b0316906350d15fbe9060240161075c565b6000546001600160a01b0316331461108b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b600361109882848361348c565b507f6741b2fc379fad678116fe3d4d4b9a1a184ab53ba36b86ad0fa66340b1ab41ad82826040516110ca929190613588565b60405180910390a15050565b6000546001600160a01b031633146111305760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b600280547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383169081179091556040519081527f482cbbbcf912da3be80deb8503ae1e94c0b7d5d1d0ec0af3d9d6403e06e609ee906020015b60405180910390a150565b6001546040517f5a503f13000000000000000000000000000000000000000000000000000000008152600481018390526060916001600160a01b031690635a503f139060240161075c565b6000546001600160a01b031633146112425760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b60025474010000000000000000000000000000000000000000900460ff16156112ad5760405162461bcd60e51b815260206004820152601060248201527f506172747320617265206c6f636b6564000000000000000000000000000000006044820152606401610690565b6001546040517f5e70664c0000000000000000000000000000000000000000000000000000000081526001600160a01b0390911690635e70664c906112f89085908590600401613588565b600060405180830381600087803b15801561131257600080fd5b505af1158015611326573d6000803e3d6000fd5b505050505050565b6060600061133b846127c5565b9050600081604051602001611350919061359c565b604051602081830303815290604052905060008260405160200161137491906135e1565b60405160208183030381529060405290506113908282876115ba565b9695505050505050565b600380546113a79061320c565b80601f01602080910402602001604051908101604052809291908181526020018280546113d39061320c565b80156114205780601f106113f557610100808354040283529160200191611420565b820191906000526020600020905b81548152906001019060200180831161140357829003601f168201915b505050505081565b6000546001600160a01b031633146114825760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b61148c6000612902565b565b6000546001600160a01b031633146114e85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b60025474010000000000000000000000000000000000000000900460ff16156115535760405162461bcd60e51b815260206004820152601060248201527f506172747320617265206c6f636b6564000000000000000000000000000000006044820152606401610690565b6001546040517f73ac736b0000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015269ffffffffffffffffffff8516602483015261ffff84166044830152909116906373ac736b906064016108cf565b6040805160808101825284815260208101849052600154835183517f04bde4dd00000000000000000000000000000000000000000000000000000000815265ffffffffffff909116600482015260609360009392908301916001600160a01b03909116906304bde4dd90602401600060405180830381865afa158015611644573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261166c919081019061307d565b815260200161167a85611c77565b90526002546040517f92ba0e90000000000000000000000000000000000000000000000000000000008152919250731efbce9a5a4add7a85cc4b30416d86e01db2bff5916392ba0e90916116de916001600160a01b0390911690859060040161364d565b600060405180830381865af41580156116fb573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611723919081019061307d565b95945050505050565b6000546001600160a01b031633146117865760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b60025474010000000000000000000000000000000000000000900460ff16156117f15760405162461bcd60e51b815260206004820152601060248201527f506172747320617265206c6f636b6564000000000000000000000000000000006044820152606401610690565b6001546040517f8bd54c0600000000000000000000000000000000000000000000000000000000815260ff841660048201526001600160a01b03838116602483015290911690638bd54c06906044016112f8565b6000546001600160a01b0316331461189f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b60025474010000000000000000000000000000000000000000900460ff161561190a5760405162461bcd60e51b815260206004820152601060248201527f506172747320617265206c6f636b6564000000000000000000000000000000006044820152606401610690565b6001546040517f91b7916a0000000000000000000000000000000000000000000000000000000081526001600160a01b03909116906391b7916a906112f890859085906004016136ef565b6000546001600160a01b031633146119af5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b60025474010000000000000000000000000000000000000000900460ff1615611a1a5760405162461bcd60e51b815260206004820152601060248201527f506172747320617265206c6f636b6564000000000000000000000000000000006044820152606401610690565b6001546040517f94f3df610000000000000000000000000000000000000000000000000000000081526001600160a01b03909116906394f3df6190610cad9087908790879087906004016131d1565b6000546001600160a01b03163314611ac35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b60025474010000000000000000000000000000000000000000900460ff1615611b2e5760405162461bcd60e51b815260206004820152601060248201527f506172747320617265206c6f636b6564000000000000000000000000000000006044820152606401610690565b6001546040517faa5bf7d80000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063aa5bf7d890610cad9087908790879087906004016131d1565b600154604080517f26ac853b00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b0316916326ac853b91600480830192869291908290030181865afa158015610db2573d6000803e3d6000fd5b6001546040517fb982d1b9000000000000000000000000000000000000000000000000000000008152600481018390526060916001600160a01b03169063b982d1b99060240161075c565b6001546040517fbc2d45fe00000000000000000000000000000000000000000000000000000000815260ff831660048201526060916001600160a01b03169063bc2d45fe9060240161075c565b60015460208201516040517f44cee73c00000000000000000000000000000000000000000000000000000000815265ffffffffffff90911660048201526060916000916001600160a01b03909116906344cee73c90602401600060405180830381865afa158015611cec573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611d14919081019061307d565b60015460408581015190517f5a503f1300000000000000000000000000000000000000000000000000000000815265ffffffffffff90911660048201529192506000916001600160a01b0390911690635a503f1390602401600060405180830381865afa158015611d89573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611db1919081019061307d565b60015460608601516040517fb982d1b900000000000000000000000000000000000000000000000000000000815265ffffffffffff90911660048201529192506000916001600160a01b039091169063b982d1b990602401600060405180830381865afa158015611e26573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611e4e919081019061307d565b60015460808701516040517f50d15fbe00000000000000000000000000000000000000000000000000000000815265ffffffffffff90911660048201529192506000916001600160a01b03909116906350d15fbe90602401600060405180830381865afa158015611ec3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611eeb919081019061307d565b60408051600480825260a0820190925291925060009190816020015b6040805180820190915260608082526020820152815260200190600190039081611f075790505090506040518060400160405280868152602001611f4a8761296a565b81525081600081518110611f6057611f606137b9565b60200260200101819052506040518060400160405280858152602001611f858661296a565b81525081600181518110611f9b57611f9b6137b9565b60200260200101819052506040518060400160405280848152602001611fc08561296a565b81525081600281518110611fd657611fd66137b9565b60200260200101819052506040518060400160405280838152602001611ffb8461296a565b81525081600381518110612011576120116137b9565b60209081029190910101529695505050505050565b600154604080517f368013dc00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163368013dc91600480830192869291908290030181865afa158015610db2573d6000803e3d6000fd5b6000546001600160a01b031633146120e25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b60025474010000000000000000000000000000000000000000900460ff161561214d5760405162461bcd60e51b815260206004820152601060248201527f506172747320617265206c6f636b6564000000000000000000000000000000006044820152606401610690565b6001546040517fcd2b82500000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015269ffffffffffffffffffff8516602483015261ffff841660448301529091169063cd2b8250906064016108cf565b6000546001600160a01b0316331461220e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b600280547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff811675010000000000000000000000000000000000000000009182900460ff1615918202179091556040518181527f360c3d72ee193226275b842f85231c259c934e85459fed80fa68e502ffa9dbde90602001611192565b6000546001600160a01b031633146122e55760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b60025474010000000000000000000000000000000000000000900460ff16156123505760405162461bcd60e51b815260206004820152601060248201527f506172747320617265206c6f636b6564000000000000000000000000000000006044820152606401610690565b600180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383169081179091556040519081527f89382d75256b43b6826ad8d6cbd8e517eaf5e10f1ef4c8f123c9a25ac4529b5590602001611192565b6000546001600160a01b031633146124105760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b60025474010000000000000000000000000000000000000000900460ff161561247b5760405162461bcd60e51b815260206004820152601060248201527f506172747320617265206c6f636b6564000000000000000000000000000000006044820152606401610690565b6001546040517fe79c9ea60000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063e79c9ea6906108cf908690869086906004016137e8565b600154604080517f222a36d000000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163222a36d091600480830192869291908290030181865afa158015610db2573d6000803e3d6000fd5b6000546001600160a01b031633146125845760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b6001600160a01b0381166126005760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610690565b61260981612902565b50565b6000546001600160a01b031633146126665760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b6001546040517f72aa4a960000000000000000000000000000000000000000000000000000000081526001600160a01b038381166004830152909116906372aa4a96906024016106e0565b6000546001600160a01b0316331461270b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b60025474010000000000000000000000000000000000000000900460ff16156127765760405162461bcd60e51b815260206004820152601060248201527f506172747320617265206c6f636b6564000000000000000000000000000000006044820152606401610690565b6001546040517ff51a8f1e0000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063f51a8f1e90610cad9087908790879087906004016131d1565b60608160000361280857505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115612832578061281c81613834565b915061282b9050600a8361389b565b915061280c565b60008167ffffffffffffffff81111561284d5761284d612af8565b6040519080825280601f01601f191660200182016040528015612877576020820181803683370190505b5090505b84156128fa5761288c6001836138af565b9150612899600a866138c2565b6128a49060306138d6565b60f81b8183815181106128b9576128b96137b9565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506128f3600a8661389b565b945061287b565b949350505050565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60015481516060916001600160a01b03169063bc2d45fe908490600090612993576129936137b9565b01602001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815260f89190911c600482015260240161075c565b6001600160a01b038116811461260957600080fd5b6000602082840312156129fe57600080fd5b8135610b92816129d7565b600060208284031215612a1b57600080fd5b5035919050565b60005b83811015612a3d578181015183820152602001612a25565b50506000910152565b60008151808452612a5e816020860160208601612a22565b601f01601f19169290920160200192915050565b602081526000610b926020830184612a46565b69ffffffffffffffffffff8116811461260957600080fd5b61ffff8116811461260957600080fd5b600080600060608486031215612ac257600080fd5b8335612acd816129d7565b92506020840135612add81612a85565b91506040840135612aed81612a9d565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715612b4a57612b4a612af8565b60405290565b6040516060810167ffffffffffffffff81118282101715612b4a57612b4a612af8565b604051601f8201601f1916810167ffffffffffffffff81118282101715612b9c57612b9c612af8565b604052919050565b803565ffffffffffff81168114612bba57600080fd5b919050565b600060a08284031215612bd157600080fd5b60405160a0810181811067ffffffffffffffff82111715612bf457612bf4612af8565b604052905080612c0383612ba4565b8152612c1160208401612ba4565b6020820152612c2260408401612ba4565b6040820152612c3360608401612ba4565b6060820152612c4460808401612ba4565b60808201525092915050565b600060a08284031215612c6257600080fd5b610b928383612bbf565b60008083601f840112612c7e57600080fd5b50813567ffffffffffffffff811115612c9657600080fd5b602083019150836020828501011115612cae57600080fd5b9250929050565b60008060008060608587031215612ccb57600080fd5b843567ffffffffffffffff811115612ce257600080fd5b612cee87828801612c6c565b9095509350506020850135612d0281612a85565b91506040850135612d1281612a9d565b939692955090935050565b60008060c08385031215612d3057600080fd5b82359150612d418460208501612bbf565b90509250929050565b60008060208385031215612d5d57600080fd5b823567ffffffffffffffff811115612d7457600080fd5b612d8085828601612c6c565b90969095509350505050565b600067ffffffffffffffff821115612da657612da6612af8565b50601f01601f191660200190565b600082601f830112612dc557600080fd5b8135612dd8612dd382612d8c565b612b73565b818152846020838601011115612ded57600080fd5b816020850160208301376000918101602001919091529392505050565b600080600060e08486031215612e1f57600080fd5b833567ffffffffffffffff80821115612e3757600080fd5b612e4387838801612db4565b94506020860135915080821115612e5957600080fd5b50612e6686828701612db4565b925050612e768560408601612bbf565b90509250925092565b803560ff81168114612bba57600080fd5b60008060408385031215612ea357600080fd5b612eac83612e7f565b91506020830135612ebc816129d7565b809150509250929050565b60008060208385031215612eda57600080fd5b823567ffffffffffffffff80821115612ef257600080fd5b818501915085601f830112612f0657600080fd5b813581811115612f1557600080fd5b8660208260051b8501011115612f2a57600080fd5b60209290920196919550909350505050565b600060208284031215612f4e57600080fd5b610b9282612e7f565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b83811015612fec577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc089840301855281518051878552612fc088860182612a46565b91890151858303868b0152919050612fd88183612a46565b968901969450505090860190600101612f7e565b509098975050505050505050565b60008060006040848603121561300f57600080fd5b61301884612e7f565b9250602084013567ffffffffffffffff81111561303457600080fd5b61304086828701612c6c565b9497909650939450505050565b600061305b612dd384612d8c565b905082815283838301111561306f57600080fd5b610b92836020830184612a22565b60006020828403121561308f57600080fd5b815167ffffffffffffffff8111156130a657600080fd5b8201601f810184136130b757600080fd5b6128fa8482516020840161304d565b600081518084526020808501808196508360051b8101915082860160005b8581101561313457828403895281516040815181875261310682880182612a46565b915050868201519150858103878701526131208183612a46565b9a87019a95505050908401906001016130e4565b5091979650505050505050565b6001600160a01b0383168152604060208201526000825160408084015261316b60808401826130c6565b905060208401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08483030160608501526113908282612a46565b818352818160208501375060006020828401015260006020601f19601f840116840101905092915050565b6060815260006131e56060830186886131a6565b905069ffffffffffffffffffff8416602083015261ffff8316604083015295945050505050565b600181811c9082168061322057607f821691505b602082108103613259577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b600080845461326d8161320c565b6001828116801561328557600181146132b8576132e7565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00841687528215158302870194506132e7565b8860005260208060002060005b858110156132de5781548a8201529084019082016132c5565b50505082870194505b5050505083516132fb818360208801612a22565b01949350505050565b6000602080838503121561331757600080fd5b825167ffffffffffffffff8082111561332f57600080fd5b8185019150604080838803121561334557600080fd5b61334d612b27565b83518381111561335c57600080fd5b8401601f8101891361336d57600080fd5b80518481111561337f5761337f612af8565b61338d878260051b01612b73565b8181528781019550606091820283018801918b8311156133ac57600080fd5b928801925b8284101561340f5780848d0312156133c95760008081fd5b6133d1612b50565b84516133dc81612a9d565b8152848a01516133eb81612a85565b818b0152848701516133fc816129d7565b81880152875295880195928301926133b1565b5083525050928401519383019390935250949350505050565b60006020828403121561343a57600080fd5b5051919050565b601f82111561348757600081815260208120601f850160051c810160208610156134685750805b601f850160051c820191505b8181101561132657828155600101613474565b505050565b67ffffffffffffffff8311156134a4576134a4612af8565b6134b8836134b2835461320c565b83613441565b6000601f84116001811461350a57600085156134d45750838201355b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600387901b1c1916600186901b17835561070e565b600083815260209020601f19861690835b8281101561353b578685013582556020948501946001909201910161351b565b5086821015613576577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88860031b161c19848701351681555b505060018560011b0183555050505050565b6020815260006128fa6020830184866131a6565b7f434e4e6f756e20000000000000000000000000000000000000000000000000008152600082516135d4816007850160208701612a22565b9190910160070192915050565b7f434e4e6f756e2000000000000000000000000000000000000000000000000000815260008251613619816007850160208701612a22565b7f2069732061206d656d626572206f662074686520434e4e6f756e732044414f006007939091019283015250602601919050565b6001600160a01b038316815260406020820152600082516080604084015261367860c0840182612a46565b905060208401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0808584030160608601526136b48383612a46565b925060408601519150808584030160808601526136d18383612a46565b925060608601519150808584030160a08601525061139082826130c6565b60208082528181018390526000906040600585901b8401810190840186845b87811015613134577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc087850301835281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18a360301811261376f57600080fd5b8901858101903567ffffffffffffffff81111561378b57600080fd5b80360382131561379a57600080fd5b6137a58682846131a6565b95505050918401919084019060010161370e565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60ff841681526040602082015260006117236040830184866131a6565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361386557613865613805565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000826138aa576138aa61386c565b500490565b818103818111156107a1576107a1613805565b6000826138d1576138d161386c565b500690565b808201808211156107a1576107a161380556fea2646970667358221220189a521bf96bb779fe5f2683f3916d9cec3130a11d01753ce68ac70e56158e7964736f6c63430008110033000000000000000000000000638af10a82db53585ae06abdc86919f2d30950c6000000000000000000000000f71df8c32d292abb73fdb09b72efe903f311a250

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102e95760003560e01c8063773b977111610191578063bf61df1b116100e3578063e6b1a3ae11610097578063f2fde38b11610071578063f2fde38b14610601578063f4513a6a14610614578063f51a8f1e1461062757600080fd5b8063e6b1a3ae146105d3578063e79c9ea6146105e6578063eba81806146105f957600080fd5b8063cd2b8250116100c8578063cd2b825014610592578063ce2f4f53146105a5578063dfe8478b146105cb57600080fd5b8063bf61df1b1461056a578063cc2aa0911461058a57600080fd5b806391b7916a11610145578063b82c1b4a1161011f578063b82c1b4a1461053c578063b982d1b914610544578063bc2d45fe1461055757600080fd5b806391b7916a1461050357806394f3df6114610516578063aa5bf7d81461052957600080fd5b80638ada6b0f116101765780638ada6b0f146104cc5780638bd54c06146104df5780638da5cb5b146104f257600080fd5b8063773b97711461048457806387db11bd146104b957600080fd5b80634531c0a81161024a5780635a503f13116101fe5780636c0360eb116101d85780636c0360eb14610461578063715018a61461046957806373ac736b1461047157600080fd5b80635a503f13146104285780635e70664c1461043b578063638ac2701461044e57600080fd5b806350d15fbe1161022f57806350d15fbe146103ef57806355f804b31461040257806356d3163d1461041557600080fd5b80634531c0a8146103d4578063461fc5af146103dc57600080fd5b8063301bd28e116102a15780633cfdafd3116102865780633cfdafd3146103985780634479cef2146103ab57806344cee73c146103c157600080fd5b8063301bd28e1461035a578063353c36a01461038557600080fd5b80631dc9637d116102d25780631dc9637d1461032c5780632a1d07691461033f5780632ea043001461034757600080fd5b8063010ecde7146102ee57806304bde4dd14610303575b600080fd5b6103016102fc3660046129ec565b61063a565b005b610316610311366004612a09565b610715565b6040516103239190612a72565b60405180910390f35b61030161033a366004612aad565b6107a7565b610301610906565b610316610355366004612c50565b610a35565b60015461036d906001600160a01b031681565b6040516001600160a01b039091168152602001610323565b610301610393366004612cb5565b610b99565b6103166103a6366004612d1d565b610ce5565b6103b3610d50565b604051908152602001610323565b6103166103cf366004612a09565b610de3565b6103b3610e2e565b6103016103ea366004612aad565b610eba565b6103166103fd366004612a09565b610fe6565b610301610410366004612d4a565b611031565b6103016104233660046129ec565b6110d6565b610316610436366004612a09565b61119d565b610301610449366004612d4a565b6111e8565b61031661045c366004612d1d565b61132e565b61031661139a565b610301611428565b61030161047f366004612aad565b61148e565b6002546104a99074010000000000000000000000000000000000000000900460ff1681565b6040519015158152602001610323565b6103166104c7366004612e0a565b6115ba565b60025461036d906001600160a01b031681565b6103016104ed366004612e90565b61172c565b6000546001600160a01b031661036d565b610301610511366004612ec7565b611845565b610301610524366004612cb5565b611955565b610301610537366004612cb5565b611a69565b6103b3611b7d565b610316610552366004612a09565b611bdf565b610316610565366004612f3c565b611c2a565b61057d610578366004612c50565b611c77565b6040516103239190612f57565b6103b3612026565b6103016105a0366004612aad565b612088565b6002546104a9907501000000000000000000000000000000000000000000900460ff1681565b6103016121b4565b6103016105e13660046129ec565b61228b565b6103016105f4366004612ffa565b6123b6565b6103b36124c8565b61030161060f3660046129ec565b61252a565b6103016106223660046129ec565b61260c565b610301610635366004612cb5565b6126b1565b6000546001600160a01b031633146106995760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6001546040517f01b9a3970000000000000000000000000000000000000000000000000000000081526001600160a01b038381166004830152909116906301b9a397906024015b600060405180830381600087803b1580156106fa57600080fd5b505af115801561070e573d6000803e3d6000fd5b5050505050565b6001546040517f04bde4dd000000000000000000000000000000000000000000000000000000008152600481018390526060916001600160a01b0316906304bde4dd906024015b600060405180830381865afa158015610779573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526107a1919081019061307d565b92915050565b6000546001600160a01b031633146108015760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b60025474010000000000000000000000000000000000000000900460ff161561086c5760405162461bcd60e51b815260206004820152601060248201527f506172747320617265206c6f636b6564000000000000000000000000000000006044820152606401610690565b6001546040517f1dc9637d0000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015269ffffffffffffffffffff8516602483015261ffff8416604483015290911690631dc9637d906064015b600060405180830381600087803b1580156108e957600080fd5b505af11580156108fd573d6000803e3d6000fd5b50505050505050565b6000546001600160a01b031633146109605760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b60025474010000000000000000000000000000000000000000900460ff16156109cb5760405162461bcd60e51b815260206004820152601060248201527f506172747320617265206c6f636b6564000000000000000000000000000000006044820152606401610690565b600280547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16740100000000000000000000000000000000000000001790556040517f1680ee6d421f70ed6030d2fc4fcb50217a5dd617858d56562b119eca59172e5790600090a1565b606060006040518060400160405280610a4d85611c77565b815260015485516040517f04bde4dd00000000000000000000000000000000000000000000000000000000815265ffffffffffff90911660048201526020909201916001600160a01b03909116906304bde4dd90602401600060405180830381865afa158015610ac1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610ae9919081019061307d565b90526002546040517f22cc1ad6000000000000000000000000000000000000000000000000000000008152919250731efbce9a5a4add7a85cc4b30416d86e01db2bff5916322cc1ad691610b4d916001600160a01b03909116908590600401613141565b600060405180830381865af4158015610b6a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b92919081019061307d565b9392505050565b6000546001600160a01b03163314610bf35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b60025474010000000000000000000000000000000000000000900460ff1615610c5e5760405162461bcd60e51b815260206004820152601060248201527f506172747320617265206c6f636b6564000000000000000000000000000000006044820152606401610690565b6001546040517f353c36a00000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063353c36a090610cad9087908790879087906004016131d1565b600060405180830381600087803b158015610cc757600080fd5b505af1158015610cdb573d6000803e3d6000fd5b5050505050505050565b6002546060907501000000000000000000000000000000000000000000900460ff1615610d1d57610d16838361132e565b90506107a1565b6003610d28846127c5565b604051602001610d3992919061325f565b604051602081830303815290604052905092915050565b600154604080517fe73dd38300000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163e73dd38391600480830192869291908290030181865afa158015610db2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610dda9190810190613304565b60200151905090565b6001546040517f44cee73c000000000000000000000000000000000000000000000000000000008152600481018390526060916001600160a01b0316906344cee73c9060240161075c565b600154604080517ffd30704b00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163fd30704b9160048083019260209291908290030181865afa158015610e91573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb59190613428565b905090565b6000546001600160a01b03163314610f145760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b60025474010000000000000000000000000000000000000000900460ff1615610f7f5760405162461bcd60e51b815260206004820152601060248201527f506172747320617265206c6f636b6564000000000000000000000000000000006044820152606401610690565b6001546040517f461fc5af0000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015269ffffffffffffffffffff8516602483015261ffff841660448301529091169063461fc5af906064016108cf565b6001546040517f50d15fbe000000000000000000000000000000000000000000000000000000008152600481018390526060916001600160a01b0316906350d15fbe9060240161075c565b6000546001600160a01b0316331461108b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b600361109882848361348c565b507f6741b2fc379fad678116fe3d4d4b9a1a184ab53ba36b86ad0fa66340b1ab41ad82826040516110ca929190613588565b60405180910390a15050565b6000546001600160a01b031633146111305760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b600280547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383169081179091556040519081527f482cbbbcf912da3be80deb8503ae1e94c0b7d5d1d0ec0af3d9d6403e06e609ee906020015b60405180910390a150565b6001546040517f5a503f13000000000000000000000000000000000000000000000000000000008152600481018390526060916001600160a01b031690635a503f139060240161075c565b6000546001600160a01b031633146112425760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b60025474010000000000000000000000000000000000000000900460ff16156112ad5760405162461bcd60e51b815260206004820152601060248201527f506172747320617265206c6f636b6564000000000000000000000000000000006044820152606401610690565b6001546040517f5e70664c0000000000000000000000000000000000000000000000000000000081526001600160a01b0390911690635e70664c906112f89085908590600401613588565b600060405180830381600087803b15801561131257600080fd5b505af1158015611326573d6000803e3d6000fd5b505050505050565b6060600061133b846127c5565b9050600081604051602001611350919061359c565b604051602081830303815290604052905060008260405160200161137491906135e1565b60405160208183030381529060405290506113908282876115ba565b9695505050505050565b600380546113a79061320c565b80601f01602080910402602001604051908101604052809291908181526020018280546113d39061320c565b80156114205780601f106113f557610100808354040283529160200191611420565b820191906000526020600020905b81548152906001019060200180831161140357829003601f168201915b505050505081565b6000546001600160a01b031633146114825760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b61148c6000612902565b565b6000546001600160a01b031633146114e85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b60025474010000000000000000000000000000000000000000900460ff16156115535760405162461bcd60e51b815260206004820152601060248201527f506172747320617265206c6f636b6564000000000000000000000000000000006044820152606401610690565b6001546040517f73ac736b0000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015269ffffffffffffffffffff8516602483015261ffff84166044830152909116906373ac736b906064016108cf565b6040805160808101825284815260208101849052600154835183517f04bde4dd00000000000000000000000000000000000000000000000000000000815265ffffffffffff909116600482015260609360009392908301916001600160a01b03909116906304bde4dd90602401600060405180830381865afa158015611644573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261166c919081019061307d565b815260200161167a85611c77565b90526002546040517f92ba0e90000000000000000000000000000000000000000000000000000000008152919250731efbce9a5a4add7a85cc4b30416d86e01db2bff5916392ba0e90916116de916001600160a01b0390911690859060040161364d565b600060405180830381865af41580156116fb573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611723919081019061307d565b95945050505050565b6000546001600160a01b031633146117865760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b60025474010000000000000000000000000000000000000000900460ff16156117f15760405162461bcd60e51b815260206004820152601060248201527f506172747320617265206c6f636b6564000000000000000000000000000000006044820152606401610690565b6001546040517f8bd54c0600000000000000000000000000000000000000000000000000000000815260ff841660048201526001600160a01b03838116602483015290911690638bd54c06906044016112f8565b6000546001600160a01b0316331461189f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b60025474010000000000000000000000000000000000000000900460ff161561190a5760405162461bcd60e51b815260206004820152601060248201527f506172747320617265206c6f636b6564000000000000000000000000000000006044820152606401610690565b6001546040517f91b7916a0000000000000000000000000000000000000000000000000000000081526001600160a01b03909116906391b7916a906112f890859085906004016136ef565b6000546001600160a01b031633146119af5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b60025474010000000000000000000000000000000000000000900460ff1615611a1a5760405162461bcd60e51b815260206004820152601060248201527f506172747320617265206c6f636b6564000000000000000000000000000000006044820152606401610690565b6001546040517f94f3df610000000000000000000000000000000000000000000000000000000081526001600160a01b03909116906394f3df6190610cad9087908790879087906004016131d1565b6000546001600160a01b03163314611ac35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b60025474010000000000000000000000000000000000000000900460ff1615611b2e5760405162461bcd60e51b815260206004820152601060248201527f506172747320617265206c6f636b6564000000000000000000000000000000006044820152606401610690565b6001546040517faa5bf7d80000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063aa5bf7d890610cad9087908790879087906004016131d1565b600154604080517f26ac853b00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b0316916326ac853b91600480830192869291908290030181865afa158015610db2573d6000803e3d6000fd5b6001546040517fb982d1b9000000000000000000000000000000000000000000000000000000008152600481018390526060916001600160a01b03169063b982d1b99060240161075c565b6001546040517fbc2d45fe00000000000000000000000000000000000000000000000000000000815260ff831660048201526060916001600160a01b03169063bc2d45fe9060240161075c565b60015460208201516040517f44cee73c00000000000000000000000000000000000000000000000000000000815265ffffffffffff90911660048201526060916000916001600160a01b03909116906344cee73c90602401600060405180830381865afa158015611cec573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611d14919081019061307d565b60015460408581015190517f5a503f1300000000000000000000000000000000000000000000000000000000815265ffffffffffff90911660048201529192506000916001600160a01b0390911690635a503f1390602401600060405180830381865afa158015611d89573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611db1919081019061307d565b60015460608601516040517fb982d1b900000000000000000000000000000000000000000000000000000000815265ffffffffffff90911660048201529192506000916001600160a01b039091169063b982d1b990602401600060405180830381865afa158015611e26573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611e4e919081019061307d565b60015460808701516040517f50d15fbe00000000000000000000000000000000000000000000000000000000815265ffffffffffff90911660048201529192506000916001600160a01b03909116906350d15fbe90602401600060405180830381865afa158015611ec3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611eeb919081019061307d565b60408051600480825260a0820190925291925060009190816020015b6040805180820190915260608082526020820152815260200190600190039081611f075790505090506040518060400160405280868152602001611f4a8761296a565b81525081600081518110611f6057611f606137b9565b60200260200101819052506040518060400160405280858152602001611f858661296a565b81525081600181518110611f9b57611f9b6137b9565b60200260200101819052506040518060400160405280848152602001611fc08561296a565b81525081600281518110611fd657611fd66137b9565b60200260200101819052506040518060400160405280838152602001611ffb8461296a565b81525081600381518110612011576120116137b9565b60209081029190910101529695505050505050565b600154604080517f368013dc00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163368013dc91600480830192869291908290030181865afa158015610db2573d6000803e3d6000fd5b6000546001600160a01b031633146120e25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b60025474010000000000000000000000000000000000000000900460ff161561214d5760405162461bcd60e51b815260206004820152601060248201527f506172747320617265206c6f636b6564000000000000000000000000000000006044820152606401610690565b6001546040517fcd2b82500000000000000000000000000000000000000000000000000000000081526001600160a01b03858116600483015269ffffffffffffffffffff8516602483015261ffff841660448301529091169063cd2b8250906064016108cf565b6000546001600160a01b0316331461220e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b600280547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff811675010000000000000000000000000000000000000000009182900460ff1615918202179091556040518181527f360c3d72ee193226275b842f85231c259c934e85459fed80fa68e502ffa9dbde90602001611192565b6000546001600160a01b031633146122e55760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b60025474010000000000000000000000000000000000000000900460ff16156123505760405162461bcd60e51b815260206004820152601060248201527f506172747320617265206c6f636b6564000000000000000000000000000000006044820152606401610690565b600180547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0383169081179091556040519081527f89382d75256b43b6826ad8d6cbd8e517eaf5e10f1ef4c8f123c9a25ac4529b5590602001611192565b6000546001600160a01b031633146124105760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b60025474010000000000000000000000000000000000000000900460ff161561247b5760405162461bcd60e51b815260206004820152601060248201527f506172747320617265206c6f636b6564000000000000000000000000000000006044820152606401610690565b6001546040517fe79c9ea60000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063e79c9ea6906108cf908690869086906004016137e8565b600154604080517f222a36d000000000000000000000000000000000000000000000000000000000815290516000926001600160a01b03169163222a36d091600480830192869291908290030181865afa158015610db2573d6000803e3d6000fd5b6000546001600160a01b031633146125845760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b6001600160a01b0381166126005760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610690565b61260981612902565b50565b6000546001600160a01b031633146126665760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b6001546040517f72aa4a960000000000000000000000000000000000000000000000000000000081526001600160a01b038381166004830152909116906372aa4a96906024016106e0565b6000546001600160a01b0316331461270b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610690565b60025474010000000000000000000000000000000000000000900460ff16156127765760405162461bcd60e51b815260206004820152601060248201527f506172747320617265206c6f636b6564000000000000000000000000000000006044820152606401610690565b6001546040517ff51a8f1e0000000000000000000000000000000000000000000000000000000081526001600160a01b039091169063f51a8f1e90610cad9087908790879087906004016131d1565b60608160000361280857505060408051808201909152600181527f3000000000000000000000000000000000000000000000000000000000000000602082015290565b8160005b8115612832578061281c81613834565b915061282b9050600a8361389b565b915061280c565b60008167ffffffffffffffff81111561284d5761284d612af8565b6040519080825280601f01601f191660200182016040528015612877576020820181803683370190505b5090505b84156128fa5761288c6001836138af565b9150612899600a866138c2565b6128a49060306138d6565b60f81b8183815181106128b9576128b96137b9565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506128f3600a8661389b565b945061287b565b949350505050565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60015481516060916001600160a01b03169063bc2d45fe908490600090612993576129936137b9565b01602001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815260f89190911c600482015260240161075c565b6001600160a01b038116811461260957600080fd5b6000602082840312156129fe57600080fd5b8135610b92816129d7565b600060208284031215612a1b57600080fd5b5035919050565b60005b83811015612a3d578181015183820152602001612a25565b50506000910152565b60008151808452612a5e816020860160208601612a22565b601f01601f19169290920160200192915050565b602081526000610b926020830184612a46565b69ffffffffffffffffffff8116811461260957600080fd5b61ffff8116811461260957600080fd5b600080600060608486031215612ac257600080fd5b8335612acd816129d7565b92506020840135612add81612a85565b91506040840135612aed81612a9d565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040805190810167ffffffffffffffff81118282101715612b4a57612b4a612af8565b60405290565b6040516060810167ffffffffffffffff81118282101715612b4a57612b4a612af8565b604051601f8201601f1916810167ffffffffffffffff81118282101715612b9c57612b9c612af8565b604052919050565b803565ffffffffffff81168114612bba57600080fd5b919050565b600060a08284031215612bd157600080fd5b60405160a0810181811067ffffffffffffffff82111715612bf457612bf4612af8565b604052905080612c0383612ba4565b8152612c1160208401612ba4565b6020820152612c2260408401612ba4565b6040820152612c3360608401612ba4565b6060820152612c4460808401612ba4565b60808201525092915050565b600060a08284031215612c6257600080fd5b610b928383612bbf565b60008083601f840112612c7e57600080fd5b50813567ffffffffffffffff811115612c9657600080fd5b602083019150836020828501011115612cae57600080fd5b9250929050565b60008060008060608587031215612ccb57600080fd5b843567ffffffffffffffff811115612ce257600080fd5b612cee87828801612c6c565b9095509350506020850135612d0281612a85565b91506040850135612d1281612a9d565b939692955090935050565b60008060c08385031215612d3057600080fd5b82359150612d418460208501612bbf565b90509250929050565b60008060208385031215612d5d57600080fd5b823567ffffffffffffffff811115612d7457600080fd5b612d8085828601612c6c565b90969095509350505050565b600067ffffffffffffffff821115612da657612da6612af8565b50601f01601f191660200190565b600082601f830112612dc557600080fd5b8135612dd8612dd382612d8c565b612b73565b818152846020838601011115612ded57600080fd5b816020850160208301376000918101602001919091529392505050565b600080600060e08486031215612e1f57600080fd5b833567ffffffffffffffff80821115612e3757600080fd5b612e4387838801612db4565b94506020860135915080821115612e5957600080fd5b50612e6686828701612db4565b925050612e768560408601612bbf565b90509250925092565b803560ff81168114612bba57600080fd5b60008060408385031215612ea357600080fd5b612eac83612e7f565b91506020830135612ebc816129d7565b809150509250929050565b60008060208385031215612eda57600080fd5b823567ffffffffffffffff80821115612ef257600080fd5b818501915085601f830112612f0657600080fd5b813581811115612f1557600080fd5b8660208260051b8501011115612f2a57600080fd5b60209290920196919550909350505050565b600060208284031215612f4e57600080fd5b610b9282612e7f565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b83811015612fec577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc089840301855281518051878552612fc088860182612a46565b91890151858303868b0152919050612fd88183612a46565b968901969450505090860190600101612f7e565b509098975050505050505050565b60008060006040848603121561300f57600080fd5b61301884612e7f565b9250602084013567ffffffffffffffff81111561303457600080fd5b61304086828701612c6c565b9497909650939450505050565b600061305b612dd384612d8c565b905082815283838301111561306f57600080fd5b610b92836020830184612a22565b60006020828403121561308f57600080fd5b815167ffffffffffffffff8111156130a657600080fd5b8201601f810184136130b757600080fd5b6128fa8482516020840161304d565b600081518084526020808501808196508360051b8101915082860160005b8581101561313457828403895281516040815181875261310682880182612a46565b915050868201519150858103878701526131208183612a46565b9a87019a95505050908401906001016130e4565b5091979650505050505050565b6001600160a01b0383168152604060208201526000825160408084015261316b60808401826130c6565b905060208401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08483030160608501526113908282612a46565b818352818160208501375060006020828401015260006020601f19601f840116840101905092915050565b6060815260006131e56060830186886131a6565b905069ffffffffffffffffffff8416602083015261ffff8316604083015295945050505050565b600181811c9082168061322057607f821691505b602082108103613259577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b600080845461326d8161320c565b6001828116801561328557600181146132b8576132e7565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00841687528215158302870194506132e7565b8860005260208060002060005b858110156132de5781548a8201529084019082016132c5565b50505082870194505b5050505083516132fb818360208801612a22565b01949350505050565b6000602080838503121561331757600080fd5b825167ffffffffffffffff8082111561332f57600080fd5b8185019150604080838803121561334557600080fd5b61334d612b27565b83518381111561335c57600080fd5b8401601f8101891361336d57600080fd5b80518481111561337f5761337f612af8565b61338d878260051b01612b73565b8181528781019550606091820283018801918b8311156133ac57600080fd5b928801925b8284101561340f5780848d0312156133c95760008081fd5b6133d1612b50565b84516133dc81612a9d565b8152848a01516133eb81612a85565b818b0152848701516133fc816129d7565b81880152875295880195928301926133b1565b5083525050928401519383019390935250949350505050565b60006020828403121561343a57600080fd5b5051919050565b601f82111561348757600081815260208120601f850160051c810160208610156134685750805b601f850160051c820191505b8181101561132657828155600101613474565b505050565b67ffffffffffffffff8311156134a4576134a4612af8565b6134b8836134b2835461320c565b83613441565b6000601f84116001811461350a57600085156134d45750838201355b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600387901b1c1916600186901b17835561070e565b600083815260209020601f19861690835b8281101561353b578685013582556020948501946001909201910161351b565b5086821015613576577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60f88860031b161c19848701351681555b505060018560011b0183555050505050565b6020815260006128fa6020830184866131a6565b7f434e4e6f756e20000000000000000000000000000000000000000000000000008152600082516135d4816007850160208701612a22565b9190910160070192915050565b7f434e4e6f756e2000000000000000000000000000000000000000000000000000815260008251613619816007850160208701612a22565b7f2069732061206d656d626572206f662074686520434e4e6f756e732044414f006007939091019283015250602601919050565b6001600160a01b038316815260406020820152600082516080604084015261367860c0840182612a46565b905060208401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0808584030160608601526136b48383612a46565b925060408601519150808584030160808601526136d18383612a46565b925060608601519150808584030160a08601525061139082826130c6565b60208082528181018390526000906040600585901b8401810190840186845b87811015613134577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc087850301835281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18a360301811261376f57600080fd5b8901858101903567ffffffffffffffff81111561378b57600080fd5b80360382131561379a57600080fd5b6137a58682846131a6565b95505050918401919084019060010161370e565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60ff841681526040602082015260006117236040830184866131a6565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361386557613865613805565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000826138aa576138aa61386c565b500490565b818103818111156107a1576107a1613805565b6000826138d1576138d161386c565b500690565b808201808211156107a1576107a161380556fea2646970667358221220189a521bf96bb779fe5f2683f3916d9cec3130a11d01753ce68ac70e56158e7964736f6c63430008110033

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

000000000000000000000000638af10a82db53585ae06abdc86919f2d30950c6000000000000000000000000f71df8c32d292abb73fdb09b72efe903f311a250

-----Decoded View---------------
Arg [0] : _art (address): 0x638Af10a82DB53585Ae06abdc86919f2D30950c6
Arg [1] : _renderer (address): 0xf71Df8C32d292Abb73fDb09B72Efe903f311a250

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000638af10a82db53585ae06abdc86919f2d30950c6
Arg [1] : 000000000000000000000000f71df8c32d292abb73fdb09b72efe903f311a250


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

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.