ETH Price: $3,146.05 (-0.16%)
Gas: 5 Gwei

Contract

0x9D63AFc505C6b2c9387ad837A1Acf23e1e4fa520
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Set Theme173749452023-05-30 23:15:35327 days ago1685488535IN
0x9D63AFc5...e1e4fa520
0 ETH0.0020558233.76950833
Set Theme169785642023-04-04 22:49:23383 days ago1680648563IN
0x9D63AFc5...e1e4fa520
0 ETH0.001514124.59841651
0x61018060169281292023-03-28 20:13:23390 days ago1680034403IN
 Create: DefaultTokenUriResolver
0 ETH0.17370139

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
DefaultTokenUriResolver

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 75 : DefaultTokenUriResolver.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

// Utility imports specific to this project
import {Theme} from "./Structs/Theme.sol";
import {StringSlicer} from "./Libraries/StringSlicer.sol";

// Utility imports
import {Base64} from "base64-sol/base64.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {Font, ITypeface} from "typeface/interfaces/ITypeface.sol";
import {LibColor, Color, newColorFromRGBString} from "solcolor/src/Color.sol";

// Juicebox imports
import {IJBTokenUriResolver} from "@jbx-protocol/juice-contracts-v3/contracts/interfaces/IJBTokenUriResolver.sol";
import {IJBToken, IJBTokenStore} from "@jbx-protocol/juice-contracts-v3/contracts/interfaces/IJBTokenStore.sol";
import {JBFundingCycle} from "@jbx-protocol/juice-contracts-v3/contracts/structs/JBFundingCycle.sol";
import {IJBPaymentTerminal} from "@jbx-protocol/juice-contracts-v3/contracts/interfaces/IJBPaymentTerminal.sol";
import {JBTokens} from "@jbx-protocol/juice-contracts-v3/contracts/libraries/JBTokens.sol";
import {JBCurrencies} from "@jbx-protocol/juice-contracts-v3/contracts/libraries/JBCurrencies.sol";
import {IJBController} from "@jbx-protocol/juice-contracts-v3/contracts/interfaces/IJBController.sol";
import {IJBController3_1, IJBDirectory, IJBFundingCycleStore} from "@jbx-protocol/juice-contracts-v3/contracts/interfaces/IJBController3_1.sol";
import {IJBOperatorStore} from "@jbx-protocol/juice-contracts-v3/contracts/interfaces/IJBOperatorStore.sol";
import {IJBPayoutRedemptionPaymentTerminal} from "@jbx-protocol/juice-contracts-v3/contracts/interfaces/IJBPayoutRedemptionPaymentTerminal.sol";
import {IJBSingleTokenPaymentTerminalStore, IJBSingleTokenPaymentTerminal} from "@jbx-protocol/juice-contracts-v3/contracts/interfaces/IJBSingleTokenPaymentTerminalStore.sol";
import {JBPayoutRedemptionPaymentTerminal} from "@jbx-protocol/juice-contracts-v3/contracts/abstract/JBPayoutRedemptionPaymentTerminal.sol";
import {IJBProjects} from "@jbx-protocol/juice-contracts-v3/contracts/interfaces/IJBProjects.sol";
import {IJBProjectHandles} from "@jbx-protocol/project-handles/contracts/interfaces/IJBProjectHandles.sol"; // Will need updating if NPM is renamed to /juice-project-handles
import {JBOperatable} from "@jbx-protocol/juice-contracts-v3/contracts/abstract/JBOperatable.sol";
import {JBUriOperations} from "./Libraries/JBUriOperations.sol";
import {IJBFundAccessConstraintsStore} from "@jbx-protocol/juice-contracts-v3/contracts/interfaces/IJBFundAccessConstraintsStore.sol";

contract DefaultTokenUriResolver is IJBTokenUriResolver, JBOperatable, Ownable {
    using Strings for uint256;
    using LibColor for Color;

    /// @notice Emitted when a theme is set. Emitted when setting default and custom themes.
    event ThemeSet(uint256 projectId, Color textColor, Color bgColor, Color bgColorAlt);

    /// @notice Emitted when a project's custom theme is reset to the default.
    event ThemeReset(uint256 projectId);

    /// @notice The address of the Juicebox Funding Cycle Store contract.
    IJBFundingCycleStore public immutable fundingCycleStore;

    /// @notice The address of the Juicebox Projects contract.
    IJBProjects public immutable projects;

    /// @notice The address of the Juicebox Directory contract.
    IJBDirectory public immutable directory;

    /// @notice The address of the Juicebox Project Handles contract.
    IJBProjectHandles public immutable projectHandles;

    /// @notice The address of the Capsules typeface contract.
    ITypeface public immutable capsulesTypeface;

    /// @notice The address of the Juicebox Controller contract.
    IJBController public immutable controller;
    IJBController3_1 public immutable controller3_1;

    /**
     * @notice Mapping containing each project's theme, if one is set. Themes describe the color palette to be used when generating the token uri SVG.
     * @dev Theme 0 is the default theme used for all projects without custom themes.
     */
    mapping(uint256 => Theme) private themes;

    constructor(
        IJBOperatorStore _operatorStore,
        IJBDirectory _directory,
        IJBController _controller,
        IJBController3_1 _controller3_1,
        IJBProjectHandles _projectHandles,
        ITypeface _capsulesTypeface
    ) JBOperatable(_operatorStore) {
        directory = _directory;
        projects = directory.projects();
        controller = _controller;
        controller3_1 = _controller3_1;
        fundingCycleStore = directory.fundingCycleStore();
        projectHandles = _projectHandles;
        capsulesTypeface = _capsulesTypeface;
        setDefaultTheme("FF9213", "44190F", "3A0F0C");
    }

    /**
     * @notice Gets the Theme for a given id in the private themes mapping.
     * @param id The id of the theme to fetch. This is the project's ID for all values except 0, which is the default theme.
     * @return Theme The Theme corresponding to the id passed as an argument.
     */
    function getTheme(uint256 id) external view returns (Theme memory) {
        return themes[id];
    }

    /**
     * @notice Gets the Base64 encoded Capsules-500.otf typeface.
     * @return fontSource The Base64 encoded font file.
     */
    function getFontSource() internal view returns (bytes memory fontSource) {
        return ITypeface(capsulesTypeface).sourceOf(Font({weight: 500, style: "normal"})); // Capsules font source
    }

    /**
     * @notice Transform strings to target length by abbreviating or padding with spaces.
     * @dev Shortens long strings to 13 characters including an ellipsis and adds left padding spaces to short strings. Allows variable target length to account for strings that have unicode characters that are longer than 1 byte but only take up 1 character space.
     * @param left True adds padding to the left of the passed string, and false adds padding to the right.
     * @param str The string to transform.
     * @param targetLength The length of the string to return.
     * @return string The transformed string.
     */
    function pad(bool left, string memory str, uint256 targetLength) internal pure returns (string memory) {
        uint256 length = bytes(str).length;

        // If string is already target length, return it
        if (length == targetLength) {
            return str;
        }

        // If string is longer than target length, abbreviate it and add an ellipsis
        // Note that the ellipsis character is 3 bytes, so the bytes length of the returned string will exceed targetLength by 2 bytes.
        if (length > targetLength) {
            str = string.concat(
                StringSlicer.slice(str, 0, targetLength - 1), // Abbreviate to 1 character less than target length
                unicode"…" // And add an ellipsis.
            );
            return str;
        }

        // If string is shorter than target length, pad it on the left or right as specified
        string memory padding;
        uint256 _paddingToAdd = targetLength - length;
        for (uint256 i; i < _paddingToAdd; ) {
            // Accumulate desired padding
            padding = string.concat(padding, " ");
            unchecked {
                ++i;
            }
        }
        str = left ? string.concat(padding, str) : string.concat(str, padding); // Add padding to left or right
        return str;
    }

    /**
     * @notice Returns either a project's handle, if set, or a string with the project's ID number if no project handle is found.
     */
    function getProjectName(uint256 _projectId) internal view returns (string memory projectName) {
        // Project Handle
        string memory _projectName;
        // If handle is set
        if (keccak256(abi.encode(projectHandles.handleOf(_projectId))) != keccak256(abi.encode(string("")))) {
            // Set projectName to handle
            _projectName = string.concat("@", projectHandles.handleOf(_projectId));
        } else {
            // Set projectName to name to 'Project #projectId'
            _projectName = string.concat("Project #", _projectId.toString());
        }
        // Abbreviate handle to 27 chars if longer
        if (bytes(_projectName).length > 26) {
            _projectName = string.concat(StringSlicer.slice(_projectName, 0, 26), unicode"…");
        }
        return _projectName;
    }

    /**
     * @notice Gets the IJBSingleTokenPaymentTerminalStore for a given project.
     */
    function getTerminalStore(uint256 _projectId) internal view returns (IJBSingleTokenPaymentTerminalStore) {
        return
            IJBSingleTokenPaymentTerminalStore(
                IJBPayoutRedemptionPaymentTerminal(
                    address(IJBPaymentTerminal(directory.primaryTerminalOf(_projectId, JBTokens.ETH)))
                ).store()
            );
    }

    /**
     * @notice Returns a right-padded string containing the project's current cycle number.
     */
    function getRightPaddedCycle(
        JBFundingCycle memory _fundingCycle
    ) internal pure returns (string memory rightPaddedCycleString) {
        uint256 currentFundingCycleId = _fundingCycle.number; // Project's current funding cycle id
        string memory fundingCycleIdString = currentFundingCycleId.toString();
        return pad(false, string.concat(unicode"  cʏcʟᴇ ", fundingCycleIdString), 19);
    }

    /**
     * @notice Returns a left-padded string containing the time left in the project's current cycle.
     */
    function getLeftPaddedTimeLeft(
        JBFundingCycle memory _fundingCycle
    ) internal view returns (string memory leftPaddedTimeLeftString) {
        // Time Left
        uint256 start = _fundingCycle.start; // Project's funding cycle start time
        uint256 duration = _fundingCycle.duration; // Project's current funding cycle duration
        uint256 timeLeft;
        string memory paddedTimeLeft;
        string memory countString;
        if (duration == 0) {
            paddedTimeLeft = string.concat(pad(true, string.concat(unicode" ɴoᴛ sᴇᴛ"), 22), "  "); // If the cycle has no duration, show NOT SET
        } else {
            timeLeft = start + duration - block.timestamp; // Time left in project's current cycle
            if (timeLeft > 2 days) {
                countString = (timeLeft / 1 days).toString();
                paddedTimeLeft = string.concat(
                    pad(true, string.concat(unicode"", " ", countString, unicode" ᴅᴀʏs"), 20),
                    "  "
                );
            } else if (timeLeft > 2 hours) {
                countString = (timeLeft / 1 hours).toString(); // 12 bytes || 8 visual + countString
                paddedTimeLeft = string.concat(
                    pad(true, string.concat(unicode"", " ", countString, unicode" ʜouʀs"), 17),
                    "  "
                );
            } else if (timeLeft > 2 minutes) {
                countString = (timeLeft / 1 minutes).toString();
                paddedTimeLeft = string.concat(
                    pad(true, string.concat(unicode"", " ", countString, unicode" ᴍɪɴuᴛᴇs"), 23),
                    "  "
                );
            } else {
                countString = (timeLeft / 1 seconds).toString();
                paddedTimeLeft = string.concat(
                    pad(true, string.concat(unicode"", " ", countString, unicode" sᴇcoɴᴅs"), 20),
                    "  "
                );
            }
        }
        return paddedTimeLeft;
    }

    /**
     * @notice Returns a string containing the cycle count and time left.
     */
    function getCycleTimeLeftRow(
        JBFundingCycle memory fundingCycle
    ) internal view returns (string memory cycleTimeLeftRow) {
        return string.concat(getRightPaddedCycle(fundingCycle), getLeftPaddedTimeLeft(fundingCycle));
    }

    /**
     * @notice Returns the balance row string.
     */
    function getBalanceRow(
        IJBPaymentTerminal primaryEthPaymentTerminal,
        uint256 _projectId
    ) internal view returns (string memory balanceRow) {
        // Balance
        uint256 balance = getTerminalStore(_projectId).balanceOf(
            IJBSingleTokenPaymentTerminal(address(primaryEthPaymentTerminal)),
            _projectId
        ) / 10 ** 18; // Project's ETH balance
        string memory paddedBalanceLeft = string.concat(
            pad(true, string.concat(unicode"Ξ", balance.toString()), 14),
            "  "
        ); // Project's ETH balance as a string
        string memory paddedBalanceRight = pad(false, unicode"  ʙᴀʟᴀɴcᴇ     ", 24);
        return string.concat(paddedBalanceRight, paddedBalanceLeft);
    }

    /**
     * @notice Returns a string containing the projects payouts. Used in the JSON metadata.
     */
    function getPayouts(
        IJBPaymentTerminal primaryEthPaymentTerminal,
        uint256 _projectId
    ) internal view returns (string memory payouts) {
        uint256 latestConfiguration = fundingCycleStore.latestConfigurationOf(_projectId); // Get project's current cycle configuration
        address controllerAddress = directory.controllerOf(_projectId); // Get project's controller address
        uint256 payoutsPreprocessed;
        uint256 payoutsCurrencyPreprocessed;
        if (controllerAddress == address(controller3_1)) {
            // If the project is using Controller v3.1
            IJBFundAccessConstraintsStore fundAccessConstraintStore = IJBFundAccessConstraintsStore(
                controller3_1.fundAccessConstraintsStore()
            );
            (payoutsPreprocessed, payoutsCurrencyPreprocessed) = fundAccessConstraintStore.distributionLimitOf(
                _projectId,
                latestConfiguration,
                primaryEthPaymentTerminal,
                JBTokens.ETH
            ); // Get raw payouts data
        }
        if (controllerAddress == address(controller)) {
            // If the project is using the original Controller
            (payoutsPreprocessed, payoutsCurrencyPreprocessed) = controller.distributionLimitOf(
                _projectId,
                latestConfiguration,
                primaryEthPaymentTerminal,
                JBTokens.ETH
            ); // Project's payouts and currency
        }
        if (payoutsPreprocessed == type(uint232).max) {
            // If are set to unlimited
            return unicode"∞"; // Return Payouts = infinity
        }
        string memory payoutsCurrency;
        payoutsCurrencyPreprocessed == 1 ? payoutsCurrency = unicode"Ξ" : payoutsCurrency = "$"; // Translate payouts currency into appropriate string
        return (string.concat(payoutsCurrency, (payoutsPreprocessed / 10 ** 18).toString())); // Return string containing currency and payouts limit
    }

    /**
     * @notice Returns the payouts row string. Used in the SVG.
     */
    function getPayoutsRow(
        IJBPaymentTerminal primaryEthPaymentTerminal,
        uint256 _projectId
    ) internal view returns (string memory payoutsRow) {
        uint256 latestConfiguration = fundingCycleStore.latestConfigurationOf(_projectId); // Get project's current cycle configuration
        string memory payoutsCurrency;
        address controllerAddress = directory.controllerOf(_projectId); // Get project's controller address
        uint256 payoutsPreprocessed;
        uint256 payoutsCurrencyPreprocessed;
        // If the project is using Controller v3.1
        if (controllerAddress == address(controller3_1)) {
            IJBFundAccessConstraintsStore fundAccessConstraintStore = IJBFundAccessConstraintsStore(
                controller3_1.fundAccessConstraintsStore()
            );
            (payoutsPreprocessed, payoutsCurrencyPreprocessed) = fundAccessConstraintStore.distributionLimitOf(
                _projectId,
                latestConfiguration,
                primaryEthPaymentTerminal,
                JBTokens.ETH
            ); // Get raw payouts data
        }
        // If the project is using the original Controller
        if (controllerAddress == address(controller)) {
            (payoutsPreprocessed, payoutsCurrencyPreprocessed) = controller.distributionLimitOf(
                _projectId,
                latestConfiguration,
                primaryEthPaymentTerminal,
                JBTokens.ETH
            ); // Project's payouts and currency
        }
        if (payoutsPreprocessed == type(uint232).max) {
            // If are set to unlimited
            return string.concat(pad(false, unicode"  ᴘᴀʏouᴛs", 22), pad(true, string.concat(unicode"∞"), 15)); // Return Payouts = infinity
        }
        if (payoutsCurrencyPreprocessed == 1) {
            payoutsCurrency = unicode"Ξ";
        } else {
            payoutsCurrency = "$";
        }
        string memory payouts = string.concat(payoutsCurrency, (payoutsPreprocessed / 10 ** 18).toString()); // Project's payouts
        string memory paddedPayoutsLeft = string.concat(pad(true, payouts, 12 + bytes(payoutsCurrency).length), "  ");
        string memory paddedPayoutsRight = string.concat(pad(false, unicode"  ᴘᴀʏouᴛs", 22));
        return string.concat(paddedPayoutsRight, paddedPayoutsLeft);
    }

    /**
     * @notice Returns the token store.
     */
    function getTokenStore(uint256 _projectId) internal view returns (IJBTokenStore) {
        address _controller = directory.controllerOf(_projectId);
        if (_controller == address(controller)) {
            IJBController c = IJBController(_controller);
            return c.tokenStore();
        }
        if (_controller == address(controller3_1)) {
            IJBController3_1 c = IJBController3_1(_controller);
            return c.tokenStore();
        }
        revert("getTokenStore: UNRECOGNIZED_CONTROLLER");
    }

    /**
     * @notice Returns the token supply row string.
     */
    function getTokenSupplyRow(uint256 _projectId) internal view returns (string memory tokenSupplyRow) {
        IJBTokenStore tokenStore = getTokenStore(_projectId);
        uint256 totalSupply = tokenStore.totalSupplyOf(_projectId) / 10 ** 18; // Project's fungible token total supply
        string memory paddedTokenSupplyLeft = string.concat(pad(true, totalSupply.toString(), 13), "  "); // Project's token token supply as a string
        string memory paddedTokenSupplyRight = pad(false, unicode"  ᴛoᴋᴇɴ suᴘᴘʟʏ", 28);
        return string.concat(paddedTokenSupplyRight, paddedTokenSupplyLeft);
    }

    /**
     *  @notice Set theme colors for a given project. Values should be 6 character strings and all letters must be uppercase (e.g, "FFFFFF").
     *  @dev Available only to project owners or operators with permission to set the token resolver on their behalf.
     *  @param _projectId The project's ID number.
     *  @param _textColor The color of the text.
     *  @param _bgColor The primary background color.
     *  @param _bgColorAlt The secondary background color.
     */
    function setTheme(
        uint256 _projectId,
        string memory _textColor,
        string memory _bgColor,
        string memory _bgColorAlt
    ) external requirePermission(projects.ownerOf(_projectId), _projectId, JBUriOperations.SET_TOKEN_URI) {
        Color textColor = newColorFromRGBString(_textColor);
        Color bgColor = newColorFromRGBString(_bgColor);
        Color bgColorAlt = newColorFromRGBString(_bgColorAlt);
        themes[_projectId] = Theme(true, textColor, bgColor, bgColorAlt); // Custom themes have the customTheme value set to True
        emit ThemeSet(_projectId, textColor, bgColor, bgColorAlt);
    }

    /**
     *  @notice Reset theme for a given project to the default.
     *  @dev Available only to project owners or operators with permission to set the token resolver on their behalf.
     *  @param _projectId The project's ID number.
     */
    function resetTheme(
        uint256 _projectId
    ) external requirePermission(projects.ownerOf(_projectId), _projectId, JBUriOperations.SET_TOKEN_URI) {
        delete themes[_projectId];
        emit ThemeReset(_projectId);
    }

    /**
     *  @notice Set default theme colors. Values should be 6 character strings and all letters must be uppercase (e.g, "FFFFFF").
     *  @dev Available only to the owner of this contract.
     *  @param _textColor The color of the text.
     *  @param _bgColor The primary background color.
     *  @param _bgColorAlt The secondary background color.
     */
    function setDefaultTheme(
        string memory _textColor,
        string memory _bgColor,
        string memory _bgColorAlt
    ) public onlyOwner {
        Color textColor = newColorFromRGBString(_textColor);
        Color bgColor = newColorFromRGBString(_bgColor);
        Color bgColorAlt = newColorFromRGBString(_bgColorAlt);
        themes[0] = Theme(true, textColor, bgColor, bgColorAlt);
        emit ThemeSet(0, textColor, bgColor, bgColorAlt);
    }

    /**
     * @notice Returns a string containing an abbreviated address as a string.
     */
    function getOwnerName(address owner) internal pure returns (string memory ownerName) {
        return
            string.concat(
                "0x",
                StringSlicer.slice(toAsciiString(owner), 0, 4),
                unicode"…",
                StringSlicer.slice(toAsciiString(owner), 36, 40)
            ); // Abbreviate owner address
    }

    /**
     * @notice Returns a string containing the project's ETH balance.
     */
    function getBalance(
        uint256 _projectId,
        IJBPaymentTerminal primaryEthPaymentTerminal
    ) internal view returns (string memory) {
        uint256 balance = getTerminalStore(_projectId).balanceOf(
            IJBSingleTokenPaymentTerminal(address(primaryEthPaymentTerminal)),
            _projectId
        ) / 10 ** 18;
        return string(abi.encodePacked(unicode"Ξ", balance.toString()));
    }

    /**
     * @notice Returns a string containing the project's ETH balance.
     */
    function getTokenSupply(uint256 _projectId) internal view returns (string memory) {
        IJBTokenStore tokenStore = getTokenStore(_projectId);
        return (tokenStore.totalSupplyOf(_projectId) / 10 ** 18).toString();
    }

    function getUpgradePromptUri(uint256 _projectId, string memory projectName) internal pure returns (string memory) {
        return
            string.concat(
                string("data:application/json;base64,"),
                Base64.encode(
                    abi.encodePacked(
                        '{"name":"',
                        projectName,
                        '", "description":"',
                        projectName,
                        " is a project on the Juicebox Protocol. The project owner must upgrade this project to V3 to enable this NFT's image. Visit https://juicebox.money/v2/p/",
                        _projectId.toString(),
                        "/settings?page=upgrades to upgrade this project.",
                        '"}'
                    )
                )
            );
    }

    /**
     *  @notice Get the token uri for a project.
     *  @dev Creates metadata for the given project ID using either the default Theme colors, or custom colors if they are set.
     *  @param _projectId The id of the project.
     *  @return tokenUri The token uri for the project.
     */
    function getUri(uint256 _projectId) external view override returns (string memory tokenUri) {
        string[] memory parts = new string[](2);
        {
            // Project Name
            string memory projectName = getProjectName(_projectId);

            // Get Project's Primary ETH Terminal
            IJBPaymentTerminal primaryEthPaymentTerminal = directory.primaryTerminalOf(_projectId, JBTokens.ETH);

            // If no primary ETH terminal is set on DirectoryV3, return upgrade prompt
            if (primaryEthPaymentTerminal == IJBPaymentTerminal(address(0))) {
                return getUpgradePromptUri(_projectId, projectName);
            }

            // Create JSON metadata and properties
            parts[0] = string(
                abi.encodePacked(
                    '{"name":"',
                    projectName,
                    '", "description":"',
                    projectName,
                    ' is a project on the Juicebox Protocol.",',
                    '"attributes":[',
                    '{"trait_type":"Balance","value":"',
                    getBalance(_projectId, primaryEthPaymentTerminal),
                    '"},',
                    '{"trait_type":"Payouts","value":"',
                    getPayouts(primaryEthPaymentTerminal, _projectId),
                    '"},',
                    '{"trait_type":"Token Supply","value":"',
                    getTokenSupply(_projectId),
                    '"}],',
                    '"image":"data:image/svg+xml;base64,'
                )
            );

            // Owner
            address owner = projects.ownerOf(_projectId); // Project's owner

            // Create SVG
            // Each line (row) of the SVG is 30 monospaced characters long
            // The first half of each line (15 chars) is the title
            // The second half of each line (15 chars) is the value
            // The first and last characters on the line are two spaces
            // The first line (head) has exceptional layout.
            parts[1] = Base64.encode(
                getPartThree(
                    getPartTwo(
                        getPartOne(_projectId, projectName),
                        _projectId,
                        primaryEthPaymentTerminal,
                        pad(false, unicode"  ᴘʀoᴊᴇcᴛ owɴᴇʀ", 28),
                        owner
                    ),
                    _projectId
                )
            );
        }

        // Complete the JSON metadata
        string memory uri = string.concat(
            string("data:application/json;base64,"),
            Base64.encode(abi.encodePacked(parts[0], parts[1], string('"}')))
        );
        return uri;
    }

    /**
     * @notice Get SVG part one.
     */
    function getPartOne(uint256 _projectId, string memory projectName) internal view returns (bytes memory) {
        Theme memory theme = themes[_projectId].customTheme == true ? themes[_projectId] : themes[0]; // Get Theme

        return
            abi.encodePacked(
                abi.encodePacked(
                    '<svg width="289" height="150" viewBox="0 0 289 150" xmlns="http://www.w3.org/2000/svg"><style>@font-face{font-family:"Capsules-500";src:url(data:font/truetype;charset=utf-8;base64,',
                    getFontSource(), // get Capsules typeface
                    ');format("opentype");}a,a:visited,a:hover{fill:inherit;text-decoration:none;}text{font-size:16px;fill:#',
                    theme.textColor.toString(),
                    ';font-family:"Capsules-500",monospace;font-weight:500;white-space:pre;}#head text{fill:#',
                    theme.bgColor.toString(),
                    ';}</style><g clip-path="url(#clip0)"><path d="M289 0H0V150H289V0Z" fill="url(#paint0)"/><rect width="289" height="22" fill="#',
                    theme.textColor.toString()
                ),
                '"/><g id="head" filter="url(#filter2)"><a href="https://juicebox.money/v2/p/',
                _projectId.toString(),
                '">', // Line 0: Head
                '<text x="16" y="16">',
                projectName,
                '</text></a><a href="https://juicebox.money"><text x="259.25" y="16">',
                unicode"",
                "</text></a></g>"
            );
    }

    /**
     * @notice Get SVG part two.
     */
    function getPartTwo(
        bytes memory _base,
        uint256 _projectId,
        IJBPaymentTerminal _primaryEthPaymentTerminal,
        string memory _projectOwnerPaddedRight,
        address owner
    ) internal view returns (bytes memory) {
        JBFundingCycle memory fundingCycle = fundingCycleStore.currentOf(_projectId);

        return
            abi.encodePacked(
                abi.encodePacked(
                    _base, // Part one
                    // Line 1: Cycle + Time left
                    '<g filter="url(#filter1)"><text x="0" y="48">',
                    getCycleTimeLeftRow(fundingCycle),
                    "</text>",
                    // Line 2: Spacer
                    '<text x="0" y="64">',
                    unicode"                              ",
                    "</text>",
                    // Line 3: Balance
                    '<text x="0" y="80">',
                    getBalanceRow(_primaryEthPaymentTerminal, _projectId),
                    "</text>"
                ),
                // Line 4: Payouts
                '<text x="0" y="96">',
                getPayoutsRow(_primaryEthPaymentTerminal, _projectId),
                "</text>",
                // Line 5: Token Supply
                '<text x="0" y="112">',
                getTokenSupplyRow(_projectId),
                "</text>",
                // Line 6: Project Owner
                '<text x="0" y="128">',
                _projectOwnerPaddedRight,
                "  ", // additional spaces hard coded for this line, presumes address is 11 chars long
                '<a href="https://etherscan.io/address/',
                toAsciiString(owner),
                '">',
                getOwnerName(owner),
                "</a>"
            );
    }

    /**
     * @notice Get SVG part three
     */
    function getPartThree(bytes memory _base, uint256 _projectId) internal view returns (bytes memory) {
        Theme memory theme = themes[_projectId].customTheme == true ? themes[_projectId] : themes[0]; // Get Theme

        return
            abi.encodePacked(
                abi.encodePacked(
                    _base,
                    '</text></g></g><defs><filter id="filter1" x="-3.36" y="26.04" width="298" height="150" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feMorphology operator="dilate" radius="0.1" in="SourceAlpha" result="thicken"/><feGaussianBlur in="thicken" stdDeviation="0.5" result="blurred"/><feFlood flood-color="#',
                    theme.textColor.toString(),
                    '" result="glowColor"/><feComposite in="glowColor" in2="blurred" operator="in" result="softGlow_colored"/><feMerge><feMergeNode in="softGlow_colored"/><feMergeNode in="SourceGraphic"/></feMerge></filter><filter id="filter2" x="0" y="0" width="298" height="150" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feMorphology operator="dilate" radius="0.05" in="SourceAlpha" result="thicken"/><feGaussianBlur in="thicken" stdDeviation="0.25" result="blurred"/><feFlood flood-color="#',
                    theme.bgColor.toString(),
                    '" result="glowColor"/><feComposite in="glowColor" in2="blurred" operator="in" result="softGlow_colored"/><feMerge><feMergeNode in="softGlow_colored"/><feMergeNode in="SourceGraphic"/></feMerge></filter><linearGradient id="paint0" x1="0" y1="202" x2="289" y2="202" gradientUnits="userSpaceOnUse"><stop stop-color="#',
                    theme.bgColorAlt.toString(),
                    '"/><stop offset="0.119792" stop-color="#'
                ),
                theme.bgColor.toString(),
                '"/><stop offset="0.848958" stop-color="#',
                theme.bgColor.toString(),
                '"/><stop offset="1" stop-color="#',
                theme.bgColorAlt.toString(),
                '"/></linearGradient><clipPath id="clip0"><rect width="289" height="150" /></clipPath></defs></svg>'
            );
    }

    /**
     * @notice Transforms addresses into strings
     * @dev borrowed from https://ethereum.stackexchange.com/questions/8346/convert-address-to-string
     */
    function toAsciiString(address x) internal pure returns (string memory) {
        bytes memory s = new bytes(40);
        for (uint256 i = 0; i < 20; ) {
            bytes1 b = bytes1(uint8(uint256(uint160(x)) / (2 ** (8 * (19 - i)))));
            bytes1 hi = bytes1(uint8(b) / 16);
            bytes1 lo = bytes1(uint8(b) - 16 * uint8(hi));
            s[2 * i] = char(hi);
            s[2 * i + 1] = char(lo);
            unchecked {
                ++i;
            }
        }
        return string(s);
    }

    /**
     * @notice Helps toAsciiString function
     */
    function char(bytes1 b) internal pure returns (bytes1 c) {
        if (uint8(b) < 10) return bytes1(uint8(b) + 0x30);
        else return bytes1(uint8(b) + 0x57);
    }
}

File 2 of 75 : Color.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.8;

import "./Types.sol";
import "./Create.sol";

library LibColor {

    function toBytes3(Color c) internal pure returns (bytes3) {
        return Color.unwrap(c);
    }

    function toRGB(Color c) internal pure returns (uint8 red, uint8 green, uint8 blue) {
        return (
            uint8(uint24(Color.unwrap(c)) >> 16),
            uint8(uint24(Color.unwrap(c)) >> 8),
            uint8(uint24(Color.unwrap(c)))
        );
    }

    // https://stackoverflow.com/a/69316712
    function toString(Color c) internal pure returns(string memory){
        bytes memory o = new bytes(6);
        o[5] = bytes1(uint8tohexchar(uint8(uint24(Color.unwrap(c)) & 0xf)));
        o[4] = bytes1(uint8tohexchar(uint8(uint24(Color.unwrap(c)) >> 4 & 0xf)));
        o[3] = bytes1(uint8tohexchar(uint8(uint24(Color.unwrap(c)) >> 8 & 0xf)));
        o[2] = bytes1(uint8tohexchar(uint8(uint24(Color.unwrap(c)) >> 12 & 0xf)));
        o[1] = bytes1(uint8tohexchar(uint8(uint24(Color.unwrap(c)) >> 16 & 0xf)));
        o[0] = bytes1(uint8tohexchar(uint8(uint24(Color.unwrap(c)) >> 20 & 0xf)));
        return string(o);
    }

    function uint8tohexchar(uint8 i) private pure returns (uint8) {
        unchecked{
            return (i > 9) ?
                (i + 55) : // ascii A-F
                (i + 48); // ascii 0-9
        }
    }
}

File 3 of 75 : Create.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.8;

import "./Types.sol";

uint8 constant SHORT_FORMAT_HEX_LENGTH = 3;
uint8 constant LONG_FORMAT_HEX_LENGTH = 6;
uint8 constant PREFIXED_LONG_FORMAT_HEX_LENGTH = LONG_FORMAT_HEX_LENGTH + 1;
uint8 constant PREFIXED_SHORT_FORMAT_HEX_LENGTH = SHORT_FORMAT_HEX_LENGTH + 1;
bytes1 constant HEX_CODE_SYMBOL = 0x23;

error INVALID_HEX_STRING();
error INVALID_HEX_CHARACTER(bytes1 _character);

function newColorFromRGB(uint8 _red, uint8 _green, uint8 _blue) pure returns (Color) {
    return Color.wrap(
        bytes3(uint24(_blue)) | (bytes3(uint24(_green)) << 8) | bytes3(uint24(_red)) << 16
    );
}

function newColorFromRGB(bytes3 _rgb) pure returns (Color) {
    return Color.wrap(_rgb);
}

function newColorFromRGBString(string memory _string) pure returns (Color) {
    bytes memory _b = bytes(_string);
    uint256 _length = _b.length;
    uint256 _offset;

    // Check if the hex code is prefixed with '#', we make a new string with the prefix removed and we try again
    // ex. #FFFFFF or #FFF
    if((
        _length == PREFIXED_LONG_FORMAT_HEX_LENGTH ||
        _length == PREFIXED_SHORT_FORMAT_HEX_LENGTH
        ) && 
        _b[0] == HEX_CODE_SYMBOL
    ){ 
        unchecked {
             --_length;
            _offset = 1;
        }
    }

    // Check if the string is a long format hex string
    // ex. FFFFFF
    if(_length == LONG_FORMAT_HEX_LENGTH){
        bytes3 _color;
        unchecked {
            uint256 _pos = 5 + _offset;

            // Unrolled loop to save gas
            _color |= bytes3(
                uint24(
                    getHexFromASCII(uint8(_b[_pos]))
                )
            );
            _color |= bytes3(
                uint24(
                    getHexFromASCII(uint8(_b[--_pos])) << 4
                )
            );
            _color |= bytes3(
                uint24(
                    getHexFromASCII(uint8(_b[--_pos])) << 8
                )
            );
            _color |= bytes3(
                uint24(
                    getHexFromASCII(uint8(_b[--_pos])) << 12
                )
            );
            _color |= bytes3(
                uint24(
                    getHexFromASCII(uint8(_b[--_pos])) << 16
                )
            );
            _color |= bytes3(
                uint24(
                    getHexFromASCII(uint8(_b[--_pos])) << 20
                )
            );
        }

        return Color.wrap(_color);

    // Check if the string is a long format hex string
    // ex. FFF
    }else if(_length == SHORT_FORMAT_HEX_LENGTH){
        bytes3 _color;

        unchecked {
            uint256 _pos = 2 + _offset;
            uint256 _char;
            // Unrolled loop to save gas
            _char = getHexFromASCII(uint8(_b[_pos]));
            _color |= bytes3(
                uint24(
                    _char
                ) | uint24(
                    _char << 4
                )
            );

            _char = getHexFromASCII(uint8(_b[--_pos]));
            _color |= bytes3(
                uint24(
                    _char << 8
                ) | uint24(
                    _char << 12
                )
            );

            _char = getHexFromASCII(uint8(_b[--_pos]));
            _color |= bytes3(
                uint24(
                    _char << 16
                ) | uint24(
                    _char << 20
                )
            );
        }

        return Color.wrap(_color);
    
    }else {
        revert INVALID_HEX_STRING();
    }
}

function getHexFromASCII(uint8 _index) pure returns(uint256){
    unchecked {
        if (_index >= 48 && _index <= 57) {
            _index -= 48;
        } else if (_index >= 65 && _index <= 70) {
            _index -= 55;
        } else {
            revert INVALID_HEX_CHARACTER(bytes1(_index));
        }
    }

    return _index;
}

File 4 of 75 : Types.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.8;
type Color is bytes3;           // #FFFFFF

File 5 of 75 : ITypeface.sol
// SPDX-License-Identifier: MIT

/**
  @title ITypeface

  @author peri

  @notice Interface for Typeface contract
 */

pragma solidity ^0.8.8;

struct Font {
    uint256 weight;
    string style;
}

interface ITypeface {
    /// @notice Emitted when the source is set for a font.
    /// @param font The font the source has been set for.
    event SetSource(Font font);

    /// @notice Emitted when the source hash is set for a font.
    /// @param font The font the source hash has been set for.
    /// @param sourceHash The source hash that was set.
    event SetSourceHash(Font font, bytes32 sourceHash);

    /// @notice Emitted when the donation address is set.
    /// @param donationAddress New donation address.
    event SetDonationAddress(address donationAddress);

    /// @notice Returns the typeface name.
    function name() external view returns (string memory);

    /// @notice Check if typeface includes a glyph for a specific character code point.
    /// @dev 3 bytes supports all possible unicodes.
    /// @param codePoint Character code point.
    /// @return true True if supported.
    function supportsCodePoint(bytes3 codePoint) external view returns (bool);

    /// @notice Return source data of Font.
    /// @param font Font to return source data for.
    /// @return source Source data of font.
    function sourceOf(Font memory font) external view returns (bytes memory);

    /// @notice Checks if source data has been stored for font.
    /// @param font Font to check if source data exists for.
    /// @return true True if source exists.
    function hasSource(Font memory font) external view returns (bool);

    /// @notice Stores source data for a font.
    /// @param font Font to store source data for.
    /// @param source Source data of font.
    function setSource(Font memory font, bytes memory source) external;

    /// @notice Sets a new donation address.
    /// @param donationAddress New donation address.
    function setDonationAddress(address donationAddress) external;

    /// @notice Returns donation address
    /// @return donationAddress Donation address.
    function donationAddress() external view returns (address);
}

File 6 of 75 : ITextResolver.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

interface ITextResolver {
    event TextChanged(
        bytes32 indexed node,
        string indexed indexedKey,
        string key,
        string value
    );

    /**
     * Returns the text data associated with an ENS node and key.
     * @param node The ENS node to query.
     * @param key The text data key to query.
     * @return The associated text data.
     */
    function text(
        bytes32 node,
        string calldata key
    ) external view returns (string memory);
}

File 7 of 75 : JBOperatable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;

import './../interfaces/IJBOperatable.sol';

/** 
  @notice
  Modifiers to allow access to functions based on the message sender's operator status.

  @dev
  Adheres to -
  IJBOperatable: General interface for the methods in this contract that interact with the blockchain's state according to the protocol's rules.
*/
abstract contract JBOperatable is IJBOperatable {
  //*********************************************************************//
  // --------------------------- custom errors -------------------------- //
  //*********************************************************************//
  error UNAUTHORIZED();

  //*********************************************************************//
  // ---------------------------- modifiers ---------------------------- //
  //*********************************************************************//

  /** 
    @notice
    Only allows the speficied account or an operator of the account to proceed. 

    @param _account The account to check for.
    @param _domain The domain namespace to look for an operator within. 
    @param _permissionIndex The index of the permission to check for. 
  */
  modifier requirePermission(
    address _account,
    uint256 _domain,
    uint256 _permissionIndex
  ) {
    _requirePermission(_account, _domain, _permissionIndex);
    _;
  }

  /** 
    @notice
    Only allows the speficied account, an operator of the account to proceed, or a truthy override flag. 

    @param _account The account to check for.
    @param _domain The domain namespace to look for an operator within. 
    @param _permissionIndex The index of the permission to check for. 
    @param _override A condition to force allowance for.
  */
  modifier requirePermissionAllowingOverride(
    address _account,
    uint256 _domain,
    uint256 _permissionIndex,
    bool _override
  ) {
    _requirePermissionAllowingOverride(_account, _domain, _permissionIndex, _override);
    _;
  }

  //*********************************************************************//
  // ---------------- public immutable stored properties --------------- //
  //*********************************************************************//

  /** 
    @notice 
    A contract storing operator assignments.
  */
  IJBOperatorStore public immutable override operatorStore;

  //*********************************************************************//
  // -------------------------- constructor ---------------------------- //
  //*********************************************************************//

  /** 
    @param _operatorStore A contract storing operator assignments.
  */
  constructor(IJBOperatorStore _operatorStore) {
    operatorStore = _operatorStore;
  }

  //*********************************************************************//
  // -------------------------- internal views ------------------------- //
  //*********************************************************************//

  /** 
    @notice
    Require the message sender is either the account or has the specified permission.

    @param _account The account to allow.
    @param _domain The domain namespace within which the permission index will be checked.
    @param _permissionIndex The permission index that an operator must have within the specified domain to be allowed.
  */
  function _requirePermission(
    address _account,
    uint256 _domain,
    uint256 _permissionIndex
  ) internal view {
    if (
      msg.sender != _account &&
      !operatorStore.hasPermission(msg.sender, _account, _domain, _permissionIndex) &&
      !operatorStore.hasPermission(msg.sender, _account, 0, _permissionIndex)
    ) revert UNAUTHORIZED();
  }

  /** 
    @notice
    Require the message sender is either the account, has the specified permission, or the override condition is true.

    @param _account The account to allow.
    @param _domain The domain namespace within which the permission index will be checked.
    @param _domain The permission index that an operator must have within the specified domain to be allowed.
    @param _override The override condition to allow.
  */
  function _requirePermissionAllowingOverride(
    address _account,
    uint256 _domain,
    uint256 _permissionIndex,
    bool _override
  ) internal view {
    if (
      !_override &&
      msg.sender != _account &&
      !operatorStore.hasPermission(msg.sender, _account, _domain, _permissionIndex) &&
      !operatorStore.hasPermission(msg.sender, _account, 0, _permissionIndex)
    ) revert UNAUTHORIZED();
  }
}

File 8 of 75 : JBPayoutRedemptionPaymentTerminal.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;

import '@openzeppelin/contracts/access/Ownable.sol';
import '@paulrberg/contracts/math/PRBMath.sol';
import './../interfaces/IJBController.sol';
import './../interfaces/IJBPayoutRedemptionPaymentTerminal.sol';
import './../libraries/JBConstants.sol';
import './../libraries/JBCurrencies.sol';
import './../libraries/JBFixedPointNumber.sol';
import './../libraries/JBFundingCycleMetadataResolver.sol';
import './../libraries/JBOperations.sol';
import './../libraries/JBTokens.sol';
import './../structs/JBPayDelegateAllocation.sol';
import './../structs/JBTokenAmount.sol';
import './JBOperatable.sol';
import './JBSingleTokenPaymentTerminal.sol';

/**
  @notice
  Generic terminal managing all inflows and outflows of funds into the protocol ecosystem.

  @dev
  A project can transfer its funds, along with the power to reconfigure and mint/burn their tokens, from this contract to another allowed terminal of the same token type contract at any time.

  @dev
  Adheres to -
  IJBPayoutRedemptionPaymentTerminal: General interface for the methods in this contract that interact with the blockchain's state according to the protocol's rules.

  @dev
  Inherits from -
  JBSingleTokenPaymentTerminal: Generic terminal managing all inflows of funds into the protocol ecosystem for one token.
  JBOperatable: Includes convenience functionality for checking a message sender's permissions before executing certain transactions.
  Ownable: Includes convenience functionality for checking a message sender's permissions before executing certain transactions.
*/
abstract contract JBPayoutRedemptionPaymentTerminal is
  JBSingleTokenPaymentTerminal,
  JBOperatable,
  Ownable,
  IJBPayoutRedemptionPaymentTerminal
{
  // A library that parses the packed funding cycle metadata into a friendlier format.
  using JBFundingCycleMetadataResolver for JBFundingCycle;

  //*********************************************************************//
  // --------------------------- custom errors ------------------------- //
  //*********************************************************************//
  error FEE_TOO_HIGH();
  error INADEQUATE_DISTRIBUTION_AMOUNT();
  error INADEQUATE_RECLAIM_AMOUNT();
  error INADEQUATE_TOKEN_COUNT();
  error NO_MSG_VALUE_ALLOWED();
  error PAY_TO_ZERO_ADDRESS();
  error PROJECT_TERMINAL_MISMATCH();
  error REDEEM_TO_ZERO_ADDRESS();
  error TERMINAL_IN_SPLIT_ZERO_ADDRESS();
  error TERMINAL_TOKENS_INCOMPATIBLE();

  //*********************************************************************//
  // ---------------------------- modifiers ---------------------------- //
  //*********************************************************************//

  /** 
    @notice 
    A modifier that verifies this terminal is a terminal of provided project ID.
  */
  modifier isTerminalOf(uint256 _projectId) {
    if (!directory.isTerminalOf(_projectId, this)) revert PROJECT_TERMINAL_MISMATCH();
    _;
  }

  //*********************************************************************//
  // --------------------- internal stored constants ------------------- //
  //*********************************************************************//

  /**
    @notice
    Maximum fee that can be set for a funding cycle configuration.

    @dev
    Out of MAX_FEE (50_000_000 / 1_000_000_000).
  */
  uint256 internal constant _FEE_CAP = 50_000_000;

  /**
    @notice
    The fee beneficiary project ID is 1, as it should be the first project launched during the deployment process.
  */
  uint256 internal constant _FEE_BENEFICIARY_PROJECT_ID = 1;

  //*********************************************************************//
  // --------------------- internal stored properties ------------------ //
  //*********************************************************************//

  /**
    @notice
    Fees that are being held to be processed later.

    _projectId The ID of the project for which fees are being held.
  */
  mapping(uint256 => JBFee[]) internal _heldFeesOf;

  //*********************************************************************//
  // ---------------- public immutable stored properties --------------- //
  //*********************************************************************//

  /**
    @notice
    Mints ERC-721's that represent project ownership and transfers.
  */
  IJBProjects public immutable override projects;

  /**
    @notice
    The directory of terminals and controllers for projects.
  */
  IJBDirectory public immutable override directory;

  /**
    @notice
    The contract that stores splits for each project.
  */
  IJBSplitsStore public immutable override splitsStore;

  /**
    @notice
    The contract that exposes price feeds.
  */
  IJBPrices public immutable override prices;

  /**
    @notice
    The contract that stores and manages the terminal's data.
  */
  IJBSingleTokenPaymentTerminalStore public immutable override store;

  /**
    @notice
    The currency to base token issuance on.

    @dev
    If this differs from `currency`, there must be a price feed available to convert `currency` to `baseWeightCurrency`.
  */
  uint256 public immutable override baseWeightCurrency;

  /**
    @notice
    The group that payout splits coming from this terminal are identified by.
  */
  uint256 public immutable override payoutSplitsGroup;

  //*********************************************************************//
  // --------------------- public stored properties -------------------- //
  //*********************************************************************//

  /**
    @notice
    The platform fee percent.

    @dev
    Out of MAX_FEE (25_000_000 / 1_000_000_000)
  */
  uint256 public override fee = 25_000_000; // 2.5%

  /**
    @notice
    The data source that returns a discount to apply to a project's fee.
  */
  IJBFeeGauge public override feeGauge;

  /**
    @notice
    Addresses that can be paid towards from this terminal without incurring a fee.

    @dev
    Only addresses that are considered to be contained within the ecosystem can be feeless. Funds sent outside the ecosystem may incur fees despite being stored as feeless.

    _address The address that can be paid toward.
  */
  mapping(address => bool) public override isFeelessAddress;

  //*********************************************************************//
  // ------------------------- external views -------------------------- //
  //*********************************************************************//

  /**
    @notice
    Gets the current overflowed amount in this terminal for a specified project, in terms of ETH.

    @dev
    The current overflow is represented as a fixed point number with 18 decimals.

    @param _projectId The ID of the project to get overflow for.

    @return The current amount of ETH overflow that project has in this terminal, as a fixed point number with 18 decimals.
  */
  function currentEthOverflowOf(uint256 _projectId)
    external
    view
    virtual
    override
    returns (uint256)
  {
    // Get this terminal's current overflow.
    uint256 _overflow = store.currentOverflowOf(this, _projectId);

    // Adjust the decimals of the fixed point number if needed to have 18 decimals.
    uint256 _adjustedOverflow = (decimals == 18)
      ? _overflow
      : JBFixedPointNumber.adjustDecimals(_overflow, decimals, 18);

    // Return the amount converted to ETH.
    return
      (currency == JBCurrencies.ETH)
        ? _adjustedOverflow
        : PRBMath.mulDiv(
          _adjustedOverflow,
          10**decimals,
          prices.priceFor(currency, JBCurrencies.ETH, decimals)
        );
  }

  /**
    @notice
    The fees that are currently being held to be processed later for each project.

    @param _projectId The ID of the project for which fees are being held.

    @return An array of fees that are being held.
  */
  function heldFeesOf(uint256 _projectId) external view override returns (JBFee[] memory) {
    return _heldFeesOf[_projectId];
  }

  //*********************************************************************//
  // -------------------------- public views --------------------------- //
  //*********************************************************************//

  /**
    @notice
    Indicates if this contract adheres to the specified interface.

    @dev 
    See {IERC165-supportsInterface}.

    @param _interfaceId The ID of the interface to check for adherance to.
  */
  function supportsInterface(bytes4 _interfaceId)
    public
    view
    virtual
    override(JBSingleTokenPaymentTerminal, IERC165)
    returns (bool)
  {
    return
      _interfaceId == type(IJBPayoutRedemptionPaymentTerminal).interfaceId ||
      _interfaceId == type(IJBPayoutTerminal).interfaceId ||
      _interfaceId == type(IJBAllowanceTerminal).interfaceId ||
      _interfaceId == type(IJBRedemptionTerminal).interfaceId ||
      _interfaceId == type(IJBOperatable).interfaceId ||
      super.supportsInterface(_interfaceId);
  }

  //*********************************************************************//
  // -------------------------- internal views ------------------------- //
  //*********************************************************************//

  /** 
    @notice
    Checks the balance of tokens in this contract.

    @return The contract's balance.
  */
  function _balance() internal view virtual returns (uint256);

  //*********************************************************************//
  // -------------------------- constructor ---------------------------- //
  //*********************************************************************//

  /**
    @param _token The token that this terminal manages.
    @param _decimals The number of decimals the token fixed point amounts are expected to have.
    @param _currency The currency that this terminal's token adheres to for price feeds.
    @param _baseWeightCurrency The currency to base token issuance on.
    @param _payoutSplitsGroup The group that denotes payout splits from this terminal in the splits store.
    @param _operatorStore A contract storing operator assignments.
    @param _projects A contract which mints ERC-721's that represent project ownership and transfers.
    @param _directory A contract storing directories of terminals and controllers for each project.
    @param _splitsStore A contract that stores splits for each project.
    @param _prices A contract that exposes price feeds.
    @param _store A contract that stores the terminal's data.
    @param _owner The address that will own this contract.
  */
  constructor(
    // payable constructor save the gas used to check msg.value==0
    address _token,
    uint256 _decimals,
    uint256 _currency,
    uint256 _baseWeightCurrency,
    uint256 _payoutSplitsGroup,
    IJBOperatorStore _operatorStore,
    IJBProjects _projects,
    IJBDirectory _directory,
    IJBSplitsStore _splitsStore,
    IJBPrices _prices,
    IJBSingleTokenPaymentTerminalStore _store,
    address _owner
  )
    payable
    JBSingleTokenPaymentTerminal(_token, _decimals, _currency)
    JBOperatable(_operatorStore)
  {
    baseWeightCurrency = _baseWeightCurrency;
    payoutSplitsGroup = _payoutSplitsGroup;
    projects = _projects;
    directory = _directory;
    splitsStore = _splitsStore;
    prices = _prices;
    store = _store;

    transferOwnership(_owner);
  }

  //*********************************************************************//
  // ---------------------- external transactions ---------------------- //
  //*********************************************************************//

  /**
    @notice
    Contribute tokens to a project.

    @param _projectId The ID of the project being paid.
    @param _amount The amount of terminal tokens being received, as a fixed point number with the same amount of decimals as this terminal. If this terminal's token is ETH, this is ignored and msg.value is used in its place.
    @param _token The token being paid. This terminal ignores this property since it only manages one token. 
    @param _beneficiary The address to mint tokens for and pass along to the funding cycle's data source and delegate.
    @param _minReturnedTokens The minimum number of project tokens expected in return, as a fixed point number with the same amount of decimals as this terminal.
    @param _preferClaimedTokens A flag indicating whether the request prefers to mint project tokens into the beneficiaries wallet rather than leaving them unclaimed. This is only possible if the project has an attached token contract. Leaving them unclaimed saves gas.
    @param _memo A memo to pass along to the emitted event, and passed along the the funding cycle's data source and delegate.  A data source can alter the memo before emitting in the event and forwarding to the delegate.
    @param _metadata Bytes to send along to the data source, delegate, and emitted event, if provided.

    @return The number of tokens minted for the beneficiary, as a fixed point number with 18 decimals.
  */
  function pay(
    uint256 _projectId,
    uint256 _amount,
    address _token,
    address _beneficiary,
    uint256 _minReturnedTokens,
    bool _preferClaimedTokens,
    string calldata _memo,
    bytes calldata _metadata
  ) external payable virtual override isTerminalOf(_projectId) returns (uint256) {
    _token; // Prevents unused var compiler and natspec complaints.

    // ETH shouldn't be sent if this terminal's token isn't ETH.
    if (token != JBTokens.ETH) {
      if (msg.value > 0) revert NO_MSG_VALUE_ALLOWED();

      // Get a reference to the balance before receiving tokens.
      uint256 _balanceBefore = _balance();

      // Transfer tokens to this terminal from the msg sender.
      _transferFrom(msg.sender, payable(address(this)), _amount);

      // The amount should reflect the change in balance.
      _amount = _balance() - _balanceBefore;
    }
    // If this terminal's token is ETH, override _amount with msg.value.
    else _amount = msg.value;

    return
      _pay(
        _amount,
        msg.sender,
        _projectId,
        _beneficiary,
        _minReturnedTokens,
        _preferClaimedTokens,
        _memo,
        _metadata
      );
  }

  /**
    @notice
    Holders can redeem their tokens to claim the project's overflowed tokens, or to trigger rules determined by the project's current funding cycle's data source.

    @dev
    Only a token holder or a designated operator can redeem its tokens.

    @param _holder The account to redeem tokens for.
    @param _projectId The ID of the project to which the tokens being redeemed belong.
    @param _tokenCount The number of project tokens to redeem, as a fixed point number with 18 decimals.
    @param _token The token being reclaimed. This terminal ignores this property since it only manages one token. 
    @param _minReturnedTokens The minimum amount of terminal tokens expected in return, as a fixed point number with the same amount of decimals as the terminal.
    @param _beneficiary The address to send the terminal tokens to.
    @param _memo A memo to pass along to the emitted event.
    @param _metadata Bytes to send along to the data source, delegate, and emitted event, if provided.

    @return reclaimAmount The amount of terminal tokens that the project tokens were redeemed for, as a fixed point number with 18 decimals.
  */
  function redeemTokensOf(
    address _holder,
    uint256 _projectId,
    uint256 _tokenCount,
    address _token,
    uint256 _minReturnedTokens,
    address payable _beneficiary,
    string memory _memo,
    bytes memory _metadata
  )
    external
    virtual
    override
    requirePermission(_holder, _projectId, JBOperations.REDEEM)
    returns (uint256 reclaimAmount)
  {
    _token; // Prevents unused var compiler and natspec complaints.

    return
      _redeemTokensOf(
        _holder,
        _projectId,
        _tokenCount,
        _minReturnedTokens,
        _beneficiary,
        _memo,
        _metadata
      );
  }

  /**
    @notice
    Distributes payouts for a project with the distribution limit of its current funding cycle.

    @dev
    Payouts are sent to the preprogrammed splits. Any leftover is sent to the project's owner.

    @dev
    Anyone can distribute payouts on a project's behalf. The project can preconfigure a wildcard split that is used to send funds to msg.sender. This can be used to incentivize calling this function.

    @dev
    All funds distributed outside of this contract or any feeless terminals incure the protocol fee.

    @param _projectId The ID of the project having its payouts distributed.
    @param _amount The amount of terminal tokens to distribute, as a fixed point number with same number of decimals as this terminal.
    @param _currency The expected currency of the amount being distributed. Must match the project's current funding cycle's distribution limit currency.
    @param _token The token being distributed. This terminal ignores this property since it only manages one token. 
    @param _minReturnedTokens The minimum number of terminal tokens that the `_amount` should be valued at in terms of this terminal's currency, as a fixed point number with the same number of decimals as this terminal.
    @param _memo A memo to pass along to the emitted event.

    @return netLeftoverDistributionAmount The amount that was sent to the project owner, as a fixed point number with the same amount of decimals as this terminal.
  */
  function distributePayoutsOf(
    uint256 _projectId,
    uint256 _amount,
    uint256 _currency,
    address _token,
    uint256 _minReturnedTokens,
    string calldata _memo
  ) external virtual override returns (uint256 netLeftoverDistributionAmount) {
    _token; // Prevents unused var compiler and natspec complaints.

    return _distributePayoutsOf(_projectId, _amount, _currency, _minReturnedTokens, _memo);
  }

  /**
    @notice
    Allows a project to send funds from its overflow up to the preconfigured allowance.

    @dev
    Only a project's owner or a designated operator can use its allowance.

    @dev
    Incurs the protocol fee.

    @param _projectId The ID of the project to use the allowance of.
    @param _amount The amount of terminal tokens to use from this project's current allowance, as a fixed point number with the same amount of decimals as this terminal.
    @param _currency The expected currency of the amount being distributed. Must match the project's current funding cycle's overflow allowance currency.
    @param _token The token being distributed. This terminal ignores this property since it only manages one token. 
    @param _minReturnedTokens The minimum number of tokens that the `_amount` should be valued at in terms of this terminal's currency, as a fixed point number with 18 decimals.
    @param _beneficiary The address to send the funds to.
    @param _memo A memo to pass along to the emitted event.

    @return netDistributedAmount The amount of tokens that was distributed to the beneficiary, as a fixed point number with the same amount of decimals as the terminal.
  */
  function useAllowanceOf(
    uint256 _projectId,
    uint256 _amount,
    uint256 _currency,
    address _token,
    uint256 _minReturnedTokens,
    address payable _beneficiary,
    string memory _memo
  )
    external
    virtual
    override
    requirePermission(projects.ownerOf(_projectId), _projectId, JBOperations.USE_ALLOWANCE)
    returns (uint256 netDistributedAmount)
  {
    _token; // Prevents unused var compiler and natspec complaints.

    return _useAllowanceOf(_projectId, _amount, _currency, _minReturnedTokens, _beneficiary, _memo);
  }

  /**
    @notice
    Allows a project owner to migrate its funds and operations to a new terminal that accepts the same token type.

    @dev
    Only a project's owner or a designated operator can migrate it.

    @param _projectId The ID of the project being migrated.
    @param _to The terminal contract that will gain the project's funds.

    @return balance The amount of funds that were migrated, as a fixed point number with the same amount of decimals as this terminal.
  */
  function migrate(uint256 _projectId, IJBPaymentTerminal _to)
    external
    virtual
    override
    requirePermission(projects.ownerOf(_projectId), _projectId, JBOperations.MIGRATE_TERMINAL)
    returns (uint256 balance)
  {
    // The terminal being migrated to must accept the same token as this terminal.
    if (!_to.acceptsToken(token, _projectId)) revert TERMINAL_TOKENS_INCOMPATIBLE();

    // Record the migration in the store.
    balance = store.recordMigration(_projectId);

    // Transfer the balance if needed.
    if (balance > 0) {
      // Trigger any inherited pre-transfer logic.
      _beforeTransferTo(address(_to), balance);

      // If this terminal's token is ETH, send it in msg.value.
      uint256 _payableValue = token == JBTokens.ETH ? balance : 0;

      // Withdraw the balance to transfer to the new terminal;
      _to.addToBalanceOf{value: _payableValue}(_projectId, balance, token, '', bytes(''));
    }

    emit Migrate(_projectId, _to, balance, msg.sender);
  }

  /**
    @notice
    Receives funds belonging to the specified project.

    @param _projectId The ID of the project to which the funds received belong.
    @param _amount The amount of tokens to add, as a fixed point number with the same number of decimals as this terminal. If this is an ETH terminal, this is ignored and msg.value is used instead.
    @param _token The token being paid. This terminal ignores this property since it only manages one currency. 
    @param _memo A memo to pass along to the emitted event.
    @param _metadata Extra data to pass along to the emitted event.
  */
  function addToBalanceOf(
    uint256 _projectId,
    uint256 _amount,
    address _token,
    string calldata _memo,
    bytes calldata _metadata
  ) external payable virtual override isTerminalOf(_projectId) {
    _token; // Prevents unused var compiler and natspec complaints.

    // If this terminal's token isn't ETH, make sure no msg.value was sent, then transfer the tokens in from msg.sender.
    if (token != JBTokens.ETH) {
      // Amount must be greater than 0.
      if (msg.value > 0) revert NO_MSG_VALUE_ALLOWED();

      // Get a reference to the balance before receiving tokens.
      uint256 _balanceBefore = _balance();

      // Transfer tokens to this terminal from the msg sender.
      _transferFrom(msg.sender, payable(address(this)), _amount);

      // The amount should reflect the change in balance.
      _amount = _balance() - _balanceBefore;
    }
    // If the terminal's token is ETH, override `_amount` with msg.value.
    else _amount = msg.value;

    // Add to balance while only refunding held fees if the funds aren't originating from a feeless terminal.
    _addToBalanceOf(_projectId, _amount, !isFeelessAddress[msg.sender], _memo, _metadata);
  }

  /**
    @notice
    Process any fees that are being held for the project.

    @dev
    Only a project owner, an operator, or the contract's owner can process held fees.

    @param _projectId The ID of the project whos held fees should be processed.
  */
  function processFees(uint256 _projectId)
    external
    virtual
    override
    requirePermissionAllowingOverride(
      projects.ownerOf(_projectId),
      _projectId,
      JBOperations.PROCESS_FEES,
      msg.sender == owner()
    )
  {
    // Get a reference to the project's held fees.
    JBFee[] memory _heldFees = _heldFeesOf[_projectId];

    // Delete the held fees.
    delete _heldFeesOf[_projectId];

    // Push array length in stack
    uint256 _heldFeeLength = _heldFees.length;

    // Process each fee.
    for (uint256 _i; _i < _heldFeeLength; ) {
      // Get the fee amount.
      uint256 _amount = _feeAmount(
        _heldFees[_i].amount,
        _heldFees[_i].fee,
        _heldFees[_i].feeDiscount
      );

      // Process the fee.
      _processFee(_amount, _heldFees[_i].beneficiary);

      emit ProcessFee(_projectId, _amount, true, _heldFees[_i].beneficiary, msg.sender);

      unchecked {
        ++_i;
      }
    }
  }

  /**
    @notice
    Allows the fee to be updated.

    @dev
    Only the owner of this contract can change the fee.

    @param _fee The new fee, out of MAX_FEE.
  */
  function setFee(uint256 _fee) external virtual override onlyOwner {
    // The provided fee must be within the max.
    if (_fee > _FEE_CAP) revert FEE_TOO_HIGH();

    // Store the new fee.
    fee = _fee;

    emit SetFee(_fee, msg.sender);
  }

  /**
    @notice
    Allows the fee gauge to be updated.

    @dev
    Only the owner of this contract can change the fee gauge.

    @param _feeGauge The new fee gauge.
  */
  function setFeeGauge(IJBFeeGauge _feeGauge) external virtual override onlyOwner {
    // Store the new fee gauge.
    feeGauge = _feeGauge;

    emit SetFeeGauge(_feeGauge, msg.sender);
  }

  /**
    @notice
    Sets whether projects operating on this terminal can pay towards the specified address without incurring a fee.

    @dev
    Only the owner of this contract can set addresses as feeless.

    @param _address The address that can be paid towards while still bypassing fees.
    @param _flag A flag indicating whether the terminal should be feeless or not.
  */
  function setFeelessAddress(address _address, bool _flag) external virtual override onlyOwner {
    // Set the flag value.
    isFeelessAddress[_address] = _flag;

    emit SetFeelessAddress(_address, _flag, msg.sender);
  }

  //*********************************************************************//
  // ---------------------- internal transactions ---------------------- //
  //*********************************************************************//

  /** 
    @notice
    Transfers tokens.

    @param _from The address from which the transfer should originate.
    @param _to The address to which the transfer should go.
    @param _amount The amount of the transfer, as a fixed point number with the same number of decimals as this terminal.
  */
  function _transferFrom(
    address _from,
    address payable _to,
    uint256 _amount
  ) internal virtual {
    _from; // Prevents unused var compiler and natspec complaints.
    _to; // Prevents unused var compiler and natspec complaints.
    _amount; // Prevents unused var compiler and natspec complaints.
  }

  /** 
    @notice
    Logic to be triggered before transferring tokens from this terminal.

    @param _to The address to which the transfer is going.
    @param _amount The amount of the transfer, as a fixed point number with the same number of decimals as this terminal.
  */
  function _beforeTransferTo(address _to, uint256 _amount) internal virtual {
    _to; // Prevents unused var compiler and natspec complaints.
    _amount; // Prevents unused var compiler and natspec complaints.
  }

  /**
    @notice
    Holders can redeem their tokens to claim the project's overflowed tokens, or to trigger rules determined by the project's current funding cycle's data source.

    @dev
    Only a token holder or a designated operator can redeem its tokens.

    @param _holder The account to redeem tokens for.
    @param _projectId The ID of the project to which the tokens being redeemed belong.
    @param _tokenCount The number of project tokens to redeem, as a fixed point number with 18 decimals.
    @param _minReturnedTokens The minimum amount of terminal tokens expected in return, as a fixed point number with the same amount of decimals as the terminal.
    @param _beneficiary The address to send the terminal tokens to.
    @param _memo A memo to pass along to the emitted event.
    @param _metadata Bytes to send along to the data source, delegate, and emitted event, if provided.

    @return reclaimAmount The amount of terminal tokens that the project tokens were redeemed for, as a fixed point number with 18 decimals.
  */
  function _redeemTokensOf(
    address _holder,
    uint256 _projectId,
    uint256 _tokenCount,
    uint256 _minReturnedTokens,
    address payable _beneficiary,
    string memory _memo,
    bytes memory _metadata
  ) internal returns (uint256 reclaimAmount) {
    // Can't send reclaimed funds to the zero address.
    if (_beneficiary == address(0)) revert REDEEM_TO_ZERO_ADDRESS();

    // Define variables that will be needed outside the scoped section below.
    // Keep a reference to the funding cycle during which the redemption is being made.
    JBFundingCycle memory _fundingCycle;

    // Scoped section prevents stack too deep. `_delegateAllocations` only used within scope.
    {
      JBRedemptionDelegateAllocation[] memory _delegateAllocations;

      // Record the redemption.
      (_fundingCycle, reclaimAmount, _delegateAllocations, _memo) = store.recordRedemptionFor(
        _holder,
        _projectId,
        _tokenCount,
        _memo,
        _metadata
      );

      // The amount being reclaimed must be at least as much as was expected.
      if (reclaimAmount < _minReturnedTokens) revert INADEQUATE_RECLAIM_AMOUNT();

      // Burn the project tokens.
      if (_tokenCount > 0)
        IJBController(directory.controllerOf(_projectId)).burnTokensOf(
          _holder,
          _projectId,
          _tokenCount,
          '',
          false
        );

      // If delegate allocations were specified by the data source, fulfill them.
      if (_delegateAllocations.length != 0) {
        // Keep a reference to the token amount being forwarded to the delegate.
        JBTokenAmount memory _forwardedAmount = JBTokenAmount(token, 0, decimals, currency);

        JBDidRedeemData memory _data = JBDidRedeemData(
          _holder,
          _projectId,
          _fundingCycle.configuration,
          _tokenCount,
          JBTokenAmount(token, reclaimAmount, decimals, currency),
          _forwardedAmount,
          _beneficiary,
          _memo,
          _metadata
        );

        uint256 _numDelegates = _delegateAllocations.length;

        for (uint256 _i; _i < _numDelegates; ) {
          // Get a reference to the delegate being iterated on.
          JBRedemptionDelegateAllocation memory _delegateAllocation = _delegateAllocations[_i];

          // Trigger any inherited pre-transfer logic.
          _beforeTransferTo(address(_delegateAllocation.delegate), _delegateAllocation.amount);

          // Keep track of the msg.value to use in the delegate call
          uint256 _payableValue;

          // If this terminal's token is ETH, send it in msg.value.
          if (token == JBTokens.ETH) _payableValue = _delegateAllocation.amount;

          // Pass the correct token forwardedAmount to the delegate
          _data.forwardedAmount.value = _delegateAllocation.amount;

          _delegateAllocation.delegate.didRedeem{value: _payableValue}(_data);

          emit DelegateDidRedeem(
            _delegateAllocation.delegate,
            _data,
            _delegateAllocation.amount,
            msg.sender
          );
          unchecked {
            ++_i;
          }
        }
      }
    }

    // Send the reclaimed funds to the beneficiary.
    if (reclaimAmount > 0) _transferFrom(address(this), _beneficiary, reclaimAmount);

    emit RedeemTokens(
      _fundingCycle.configuration,
      _fundingCycle.number,
      _projectId,
      _holder,
      _beneficiary,
      _tokenCount,
      reclaimAmount,
      _memo,
      _metadata,
      msg.sender
    );
  }

  /**
    @notice
    Distributes payouts for a project with the distribution limit of its current funding cycle.

    @dev
    Payouts are sent to the preprogrammed splits. Any leftover is sent to the project's owner.

    @dev
    Anyone can distribute payouts on a project's behalf. The project can preconfigure a wildcard split that is used to send funds to msg.sender. This can be used to incentivize calling this function.

    @dev
    All funds distributed outside of this contract or any feeless terminals incure the protocol fee.

    @param _projectId The ID of the project having its payouts distributed.
    @param _amount The amount of terminal tokens to distribute, as a fixed point number with same number of decimals as this terminal.
    @param _currency The expected currency of the amount being distributed. Must match the project's current funding cycle's distribution limit currency.
    @param _minReturnedTokens The minimum number of terminal tokens that the `_amount` should be valued at in terms of this terminal's currency, as a fixed point number with the same number of decimals as this terminal.
    @param _memo A memo to pass along to the emitted event.

    @return netLeftoverDistributionAmount The amount that was sent to the project owner, as a fixed point number with the same amount of decimals as this terminal.
  */
  function _distributePayoutsOf(
    uint256 _projectId,
    uint256 _amount,
    uint256 _currency,
    uint256 _minReturnedTokens,
    string calldata _memo
  ) internal returns (uint256 netLeftoverDistributionAmount) {
    // Record the distribution.
    (JBFundingCycle memory _fundingCycle, uint256 _distributedAmount) = store.recordDistributionFor(
      _projectId,
      _amount,
      _currency
    );

    // The amount being distributed must be at least as much as was expected.
    if (_distributedAmount < _minReturnedTokens) revert INADEQUATE_DISTRIBUTION_AMOUNT();

    // Get a reference to the project owner, which will receive tokens from paying the platform fee
    // and receive any extra distributable funds not allocated to payout splits.
    address payable _projectOwner = payable(projects.ownerOf(_projectId));

    // Define variables that will be needed outside the scoped section below.
    // Keep a reference to the fee amount that was paid.
    uint256 _fee;

    // Scoped section prevents stack too deep. `_feeDiscount`, `_feeEligibleDistributionAmount`, and `_leftoverDistributionAmount` only used within scope.
    {
      // Get the amount of discount that should be applied to any fees taken.
      // If the fee is zero, set the discount to 100% for convenience.
      uint256 _feeDiscount = fee == 0
        ? JBConstants.MAX_FEE_DISCOUNT
        : _currentFeeDiscount(_projectId);

      // The amount distributed that is eligible for incurring fees.
      uint256 _feeEligibleDistributionAmount;

      // The amount leftover after distributing to the splits.
      uint256 _leftoverDistributionAmount;

      // Payout to splits and get a reference to the leftover transfer amount after all splits have been paid.
      // Also get a reference to the amount that was distributed to splits from which fees should be taken.
      (_leftoverDistributionAmount, _feeEligibleDistributionAmount) = _distributeToPayoutSplitsOf(
        _projectId,
        _fundingCycle.configuration,
        payoutSplitsGroup,
        _distributedAmount,
        _feeDiscount
      );

      if (_feeDiscount != JBConstants.MAX_FEE_DISCOUNT) {
        // Leftover distribution amount is also eligible for a fee since the funds are going out of the ecosystem to _beneficiary.
        unchecked {
          _feeEligibleDistributionAmount += _leftoverDistributionAmount;
        }
      }

      // Take the fee.
      _fee = _feeEligibleDistributionAmount != 0
        ? _takeFeeFrom(
          _projectId,
          _fundingCycle,
          _feeEligibleDistributionAmount,
          _projectOwner,
          _feeDiscount
        )
        : 0;

      // Transfer any remaining balance to the project owner and update returned leftover accordingly.
      if (_leftoverDistributionAmount != 0) {
        // Subtract the fee from the net leftover amount.
        netLeftoverDistributionAmount =
          _leftoverDistributionAmount -
          _feeAmount(_leftoverDistributionAmount, fee, _feeDiscount);

        // Transfer the amount to the project owner.
        _transferFrom(address(this), _projectOwner, netLeftoverDistributionAmount);
      }
    }

    emit DistributePayouts(
      _fundingCycle.configuration,
      _fundingCycle.number,
      _projectId,
      _projectOwner,
      _amount,
      _distributedAmount,
      _fee,
      netLeftoverDistributionAmount,
      _memo,
      msg.sender
    );
  }

  /**
    @notice
    Allows a project to send funds from its overflow up to the preconfigured allowance.

    @dev
    Only a project's owner or a designated operator can use its allowance.

    @dev
    Incurs the protocol fee.

    @param _projectId The ID of the project to use the allowance of.
    @param _amount The amount of terminal tokens to use from this project's current allowance, as a fixed point number with the same amount of decimals as this terminal.
    @param _currency The expected currency of the amount being distributed. Must match the project's current funding cycle's overflow allowance currency.
    @param _minReturnedTokens The minimum number of tokens that the `_amount` should be valued at in terms of this terminal's currency, as a fixed point number with 18 decimals.
    @param _beneficiary The address to send the funds to.
    @param _memo A memo to pass along to the emitted event.

    @return netDistributedAmount The amount of tokens that was distributed to the beneficiary, as a fixed point number with the same amount of decimals as the terminal.
  */
  function _useAllowanceOf(
    uint256 _projectId,
    uint256 _amount,
    uint256 _currency,
    uint256 _minReturnedTokens,
    address payable _beneficiary,
    string memory _memo
  ) internal returns (uint256 netDistributedAmount) {
    // Record the use of the allowance.
    (JBFundingCycle memory _fundingCycle, uint256 _distributedAmount) = store.recordUsedAllowanceOf(
      _projectId,
      _amount,
      _currency
    );

    // The amount being withdrawn must be at least as much as was expected.
    if (_distributedAmount < _minReturnedTokens) revert INADEQUATE_DISTRIBUTION_AMOUNT();

    // Scoped section prevents stack too deep. `_fee`, `_projectOwner`, `_feeDiscount`, and `_netAmount` only used within scope.
    {
      // Keep a reference to the fee amount that was paid.
      uint256 _fee;

      // Get a reference to the project owner, which will receive tokens from paying the platform fee.
      address _projectOwner = projects.ownerOf(_projectId);

      // Get the amount of discount that should be applied to any fees taken.
      // If the fee is zero or if the fee is being used by an address that doesn't incur fees, set the discount to 100% for convenience.
      uint256 _feeDiscount = fee == 0 || isFeelessAddress[msg.sender]
        ? JBConstants.MAX_FEE_DISCOUNT
        : _currentFeeDiscount(_projectId);

      // Take a fee from the `_distributedAmount`, if needed.
      _fee = _feeDiscount == JBConstants.MAX_FEE_DISCOUNT
        ? 0
        : _takeFeeFrom(_projectId, _fundingCycle, _distributedAmount, _projectOwner, _feeDiscount);

      unchecked {
        // The net amount is the withdrawn amount without the fee.
        netDistributedAmount = _distributedAmount - _fee;
      }

      // Transfer any remaining balance to the beneficiary.
      if (netDistributedAmount > 0)
        _transferFrom(address(this), _beneficiary, netDistributedAmount);
    }

    emit UseAllowance(
      _fundingCycle.configuration,
      _fundingCycle.number,
      _projectId,
      _beneficiary,
      _amount,
      _distributedAmount,
      netDistributedAmount,
      _memo,
      msg.sender
    );
  }

  /**
    @notice
    Pays out splits for a project's funding cycle configuration.

    @param _projectId The ID of the project for which payout splits are being distributed.
    @param _domain The domain of the splits to distribute the payout between.
    @param _group The group of the splits to distribute the payout between.
    @param _amount The total amount being distributed, as a fixed point number with the same number of decimals as this terminal.
    @param _feeDiscount The amount of discount to apply to the fee, out of the MAX_FEE.

    @return leftoverAmount If the leftover amount if the splits don't add up to 100%.
    @return feeEligibleDistributionAmount The total amount of distributions that are eligible to have fees taken from.
  */
  function _distributeToPayoutSplitsOf(
    uint256 _projectId,
    uint256 _domain,
    uint256 _group,
    uint256 _amount,
    uint256 _feeDiscount
  ) internal returns (uint256 leftoverAmount, uint256 feeEligibleDistributionAmount) {
    // Set the leftover amount to the initial amount.
    leftoverAmount = _amount;
    // The total percentage available to split
    uint256 leftoverPercentage = JBConstants.SPLITS_TOTAL_PERCENT;

    // Get a reference to the project's payout splits.
    JBSplit[] memory _splits = splitsStore.splitsOf(_projectId, _domain, _group);

    // Transfer between all splits.
    for (uint256 _i; _i < _splits.length; ) {
      // Get a reference to the split being iterated on.
      JBSplit memory _split = _splits[_i];

      // The amount to send towards the split.
      uint256 _payoutAmount = _split.percent == leftoverPercentage
        ? leftoverAmount
        : PRBMath.mulDiv(_amount, _split.percent, JBConstants.SPLITS_TOTAL_PERCENT);

      // Decrement the leftover percentage.
      leftoverPercentage -= _split.percent;

      // The payout amount substracting any applicable incurred fees.
      uint256 _netPayoutAmount;

      if (_payoutAmount > 0) {
        // Transfer tokens to the split.
        // If there's an allocator set, transfer to its `allocate` function.
        if (_split.allocator != IJBSplitAllocator(address(0))) {
          // If the split allocator is set as feeless, this distribution is not eligible for a fee.
          if (
            _feeDiscount == JBConstants.MAX_FEE_DISCOUNT ||
            isFeelessAddress[address(_split.allocator)]
          )
            _netPayoutAmount = _payoutAmount;
            // This distribution is eligible for a fee since the funds are leaving this contract and the allocator isn't listed as feeless.
          else {
            unchecked {
              _netPayoutAmount = _payoutAmount - _feeAmount(_payoutAmount, fee, _feeDiscount);
            }

            // This distribution is eligible for a fee since the funds are leaving the ecosystem.
            feeEligibleDistributionAmount += _payoutAmount;
          }

          // Trigger any inherited pre-transfer logic.
          _beforeTransferTo(address(_split.allocator), _netPayoutAmount);

          // Create the data to send to the allocator.
          JBSplitAllocationData memory _data = JBSplitAllocationData(
            token,
            _netPayoutAmount,
            decimals,
            _projectId,
            _group,
            _split
          );

          // Trigger the allocator's `allocate` function.
          // If this terminal's token is ETH, send it in msg.value.
          _split.allocator.allocate{value: token == JBTokens.ETH ? _netPayoutAmount : 0}(_data);

          // Otherwise, if a project is specified, make a payment to it.
        } else if (_split.projectId != 0) {
          // Get a reference to the Juicebox terminal being used.
          IJBPaymentTerminal _terminal = directory.primaryTerminalOf(_split.projectId, token);

          // The project must have a terminal to send funds to.
          if (_terminal == IJBPaymentTerminal(address(0))) revert TERMINAL_IN_SPLIT_ZERO_ADDRESS();

          // Save gas if this contract is being used as the terminal.
          if (_terminal == this) {
            // This distribution does not incur a fee.
            _netPayoutAmount = _payoutAmount;

            // Send the projectId in the metadata.
            bytes memory _projectMetadata = new bytes(32);
            _projectMetadata = bytes(abi.encodePacked(_projectId));

            // Add to balance if prefered.
            if (_split.preferAddToBalance)
              _addToBalanceOf(_split.projectId, _netPayoutAmount, false, '', _projectMetadata);
            else
              _pay(
                _netPayoutAmount,
                address(this),
                _split.projectId,
                (_split.beneficiary != address(0)) ? _split.beneficiary : msg.sender,
                0,
                _split.preferClaimed,
                '',
                _projectMetadata
              );
          } else {
            // If the terminal is set as feeless, this distribution is not eligible for a fee.
            if (
              _feeDiscount == JBConstants.MAX_FEE_DISCOUNT || isFeelessAddress[address(_terminal)]
            )
              _netPayoutAmount = _payoutAmount;
              // This distribution is eligible for a fee since the funds are leaving this contract and the terminal isn't listed as feeless.
            else {
              unchecked {
                _netPayoutAmount = _payoutAmount - _feeAmount(_payoutAmount, fee, _feeDiscount);
              }

              feeEligibleDistributionAmount += _payoutAmount;
            }

            // Trigger any inherited pre-transfer logic.
            _beforeTransferTo(address(_terminal), _netPayoutAmount);

            // If this terminal's token is ETH, send it in msg.value.
            uint256 _payableValue = token == JBTokens.ETH ? _netPayoutAmount : 0;

            // Send the projectId in the metadata.
            bytes memory _projectMetadata = new bytes(32);
            _projectMetadata = bytes(abi.encodePacked(_projectId));

            // Add to balance if prefered.
            if (_split.preferAddToBalance)
              _terminal.addToBalanceOf{value: _payableValue}(
                _split.projectId,
                _netPayoutAmount,
                token,
                '',
                _projectMetadata
              );
            else
              _terminal.pay{value: _payableValue}(
                _split.projectId,
                _netPayoutAmount,
                token,
                _split.beneficiary != address(0) ? _split.beneficiary : msg.sender,
                0,
                _split.preferClaimed,
                '',
                _projectMetadata
              );
          }
        } else {
          // Keep a reference to the beneficiary.
          address payable _beneficiary = _split.beneficiary != address(0)
            ? _split.beneficiary
            : payable(msg.sender);

          // If there's a full discount, this distribution is not eligible for a fee.
          // Don't enforce feeless address for the beneficiary since the funds are leaving the ecosystem.
          if (_feeDiscount == JBConstants.MAX_FEE_DISCOUNT)
            _netPayoutAmount = _payoutAmount;
            // This distribution is eligible for a fee since the funds are leaving this contract and the beneficiary isn't listed as feeless.
          else {
            unchecked {
              _netPayoutAmount = _payoutAmount - _feeAmount(_payoutAmount, fee, _feeDiscount);
            }

            feeEligibleDistributionAmount += _payoutAmount;
          }

          // If there's a beneficiary, send the funds directly to the beneficiary. Otherwise send to the msg.sender.
          _transferFrom(address(this), _beneficiary, _netPayoutAmount);
        }

        // Subtract from the amount to be sent to the beneficiary.
        unchecked {
          leftoverAmount = leftoverAmount - _payoutAmount;
        }
      }

      emit DistributeToPayoutSplit(
        _projectId,
        _domain,
        _group,
        _split,
        _netPayoutAmount,
        msg.sender
      );

      unchecked {
        ++_i;
      }
    }
  }

  /**
    @notice
    Takes a fee into the platform's project, which has an id of _FEE_BENEFICIARY_PROJECT_ID.

    @param _projectId The ID of the project having fees taken from.
    @param _fundingCycle The funding cycle during which the fee is being taken.
    @param _amount The amount of the fee to take, as a floating point number with 18 decimals.
    @param _beneficiary The address to mint the platforms tokens for.
    @param _feeDiscount The amount of discount to apply to the fee, out of the MAX_FEE.

    @return feeAmount The amount of the fee taken.
  */
  function _takeFeeFrom(
    uint256 _projectId,
    JBFundingCycle memory _fundingCycle,
    uint256 _amount,
    address _beneficiary,
    uint256 _feeDiscount
  ) internal returns (uint256 feeAmount) {
    feeAmount = _feeAmount(_amount, fee, _feeDiscount);

    if (_fundingCycle.shouldHoldFees()) {
      // Store the held fee.
      _heldFeesOf[_projectId].push(JBFee(_amount, uint32(fee), uint32(_feeDiscount), _beneficiary));

      emit HoldFee(_projectId, _amount, fee, _feeDiscount, _beneficiary, msg.sender);
    } else {
      // Process the fee.
      _processFee(feeAmount, _beneficiary); // Take the fee.

      emit ProcessFee(_projectId, feeAmount, false, _beneficiary, msg.sender);
    }
  }

  /**
    @notice
    Process a fee of the specified amount.

    @param _amount The fee amount, as a floating point number with 18 decimals.
    @param _beneficiary The address to mint the platform's tokens for.
  */
  function _processFee(uint256 _amount, address _beneficiary) internal {
    // Get the terminal for the protocol project.
    IJBPaymentTerminal _terminal = directory.primaryTerminalOf(_FEE_BENEFICIARY_PROJECT_ID, token);

    // When processing the admin fee, save gas if the admin is using this contract as its terminal.
    if (_terminal == this)
      _pay(
        _amount,
        address(this),
        _FEE_BENEFICIARY_PROJECT_ID,
        _beneficiary,
        0,
        false,
        '',
        bytes('')
      ); // Use the local pay call.
    else {
      // Trigger any inherited pre-transfer logic.
      _beforeTransferTo(address(_terminal), _amount);

      // If this terminal's token is ETH, send it in msg.value.
      uint256 _payableValue = token == JBTokens.ETH ? _amount : 0;

      // Send the payment.
      _terminal.pay{value: _payableValue}(
        _FEE_BENEFICIARY_PROJECT_ID,
        _amount,
        token,
        _beneficiary,
        0,
        false,
        '',
        bytes('')
      ); // Use the external pay call of the correct terminal.
    }
  }

  /**
    @notice
    Contribute tokens to a project.

    @param _amount The amount of terminal tokens being received, as a fixed point number with the same amount of decimals as this terminal. If this terminal's token is ETH, this is ignored and msg.value is used in its place.
    @param _payer The address making the payment.
    @param _projectId The ID of the project being paid.
    @param _beneficiary The address to mint tokens for and pass along to the funding cycle's data source and delegate.
    @param _minReturnedTokens The minimum number of project tokens expected in return, as a fixed point number with the same amount of decimals as this terminal.
    @param _preferClaimedTokens A flag indicating whether the request prefers to mint project tokens into the beneficiaries wallet rather than leaving them unclaimed. This is only possible if the project has an attached token contract. Leaving them unclaimed saves gas.
    @param _memo A memo to pass along to the emitted event, and passed along the the funding cycle's data source and delegate.  A data source can alter the memo before emitting in the event and forwarding to the delegate.
    @param _metadata Bytes to send along to the data source, delegate, and emitted event, if provided.

    @return beneficiaryTokenCount The number of tokens minted for the beneficiary, as a fixed point number with 18 decimals.
  */
  function _pay(
    uint256 _amount,
    address _payer,
    uint256 _projectId,
    address _beneficiary,
    uint256 _minReturnedTokens,
    bool _preferClaimedTokens,
    string memory _memo,
    bytes memory _metadata
  ) internal returns (uint256 beneficiaryTokenCount) {
    // Cant send tokens to the zero address.
    if (_beneficiary == address(0)) revert PAY_TO_ZERO_ADDRESS();

    // Define variables that will be needed outside the scoped section below.
    // Keep a reference to the funding cycle during which the payment is being made.
    JBFundingCycle memory _fundingCycle;

    // Scoped section prevents stack too deep. `_delegateAllocations` and `_tokenCount` only used within scope.
    {
      JBPayDelegateAllocation[] memory _delegateAllocations;
      uint256 _tokenCount;

      // Bundle the amount info into a JBTokenAmount struct.
      JBTokenAmount memory _bundledAmount = JBTokenAmount(token, _amount, decimals, currency);

      // Record the payment.
      (_fundingCycle, _tokenCount, _delegateAllocations, _memo) = store.recordPaymentFrom(
        _payer,
        _bundledAmount,
        _projectId,
        baseWeightCurrency,
        _beneficiary,
        _memo,
        _metadata
      );

      // Mint the tokens if needed.
      if (_tokenCount > 0)
        // Set token count to be the number of tokens minted for the beneficiary instead of the total amount.
        beneficiaryTokenCount = IJBController(directory.controllerOf(_projectId)).mintTokensOf(
          _projectId,
          _tokenCount,
          _beneficiary,
          '',
          _preferClaimedTokens,
          true
        );

      // The token count for the beneficiary must be greater than or equal to the minimum expected.
      if (beneficiaryTokenCount < _minReturnedTokens) revert INADEQUATE_TOKEN_COUNT();

      // If delegate allocations were specified by the data source, fulfill them.
      if (_delegateAllocations.length != 0) {
        // Keep a reference to the token amount being forwarded to the delegate.
        JBTokenAmount memory _forwardedAmount = JBTokenAmount(token, _amount, decimals, currency);

        JBDidPayData memory _data = JBDidPayData(
          _payer,
          _projectId,
          _fundingCycle.configuration,
          _bundledAmount,
          _forwardedAmount,
          beneficiaryTokenCount,
          _beneficiary,
          _preferClaimedTokens,
          _memo,
          _metadata
        );

        // Get a reference to the number of delegates to allocate to.
        uint256 _numDelegates = _delegateAllocations.length;

        for (uint256 _i; _i < _numDelegates; ) {
          // Get a reference to the delegate being iterated on.
          JBPayDelegateAllocation memory _delegateAllocation = _delegateAllocations[_i];

          // Trigger any inherited pre-transfer logic.
          _beforeTransferTo(address(_delegateAllocation.delegate), _delegateAllocation.amount);

          // Keep track of the msg.value to use in the delegate call
          uint256 _payableValue;

          // If this terminal's token is ETH, send it in msg.value.
          if (token == JBTokens.ETH) _payableValue = _delegateAllocation.amount;

          // Pass the correct token forwardedAmount to the delegate
          _data.forwardedAmount.value = _delegateAllocation.amount;

          _delegateAllocation.delegate.didPay{value: _payableValue}(_data);

          emit DelegateDidPay(
            _delegateAllocation.delegate,
            _data,
            _delegateAllocation.amount,
            msg.sender
          );

          unchecked {
            ++_i;
          }
        }
      }
    }

    emit Pay(
      _fundingCycle.configuration,
      _fundingCycle.number,
      _projectId,
      _payer,
      _beneficiary,
      _amount,
      beneficiaryTokenCount,
      _memo,
      _metadata,
      msg.sender
    );
  }

  /**
    @notice
    Receives funds belonging to the specified project.

    @param _projectId The ID of the project to which the funds received belong.
    @param _amount The amount of tokens to add, as a fixed point number with the same number of decimals as this terminal. If this is an ETH terminal, this is ignored and msg.value is used instead.
    @param _shouldRefundHeldFees A flag indicating if held fees should be refunded based on the amount being added.
    @param _memo A memo to pass along to the emitted event.
    @param _metadata Extra data to pass along to the emitted event.
  */
  function _addToBalanceOf(
    uint256 _projectId,
    uint256 _amount,
    bool _shouldRefundHeldFees,
    string memory _memo,
    bytes memory _metadata
  ) internal {
    // Refund any held fees to make sure the project doesn't pay double for funds going in and out of the protocol.
    uint256 _refundedFees = _shouldRefundHeldFees ? _refundHeldFees(_projectId, _amount) : 0;

    // Record the added funds with any refunded fees.
    store.recordAddedBalanceFor(_projectId, _amount + _refundedFees);

    emit AddToBalance(_projectId, _amount, _refundedFees, _memo, _metadata, msg.sender);
  }

  /**
    @notice
    Refund fees based on the specified amount.

    @param _projectId The project for which fees are being refunded.
    @param _amount The amount to base the refund on, as a fixed point number with the same amount of decimals as this terminal.

    @return refundedFees How much fees were refunded, as a fixed point number with the same number of decimals as this terminal
  */
  function _refundHeldFees(uint256 _projectId, uint256 _amount)
    internal
    returns (uint256 refundedFees)
  {
    // Get a reference to the project's held fees.
    JBFee[] memory _heldFees = _heldFeesOf[_projectId];

    // Delete the current held fees.
    delete _heldFeesOf[_projectId];

    // Get a reference to the leftover amount once all fees have been settled.
    uint256 leftoverAmount = _amount;

    // Push length in stack
    uint256 _heldFeesLength = _heldFees.length;

    // Process each fee.
    for (uint256 _i; _i < _heldFeesLength; ) {
      if (leftoverAmount == 0) _heldFeesOf[_projectId].push(_heldFees[_i]);
      else if (leftoverAmount >= _heldFees[_i].amount) {
        unchecked {
          leftoverAmount = leftoverAmount - _heldFees[_i].amount;
          refundedFees += _feeAmount(
            _heldFees[_i].amount,
            _heldFees[_i].fee,
            _heldFees[_i].feeDiscount
          );
        }
      } else {
        unchecked {
          _heldFeesOf[_projectId].push(
            JBFee(
              _heldFees[_i].amount - leftoverAmount,
              _heldFees[_i].fee,
              _heldFees[_i].feeDiscount,
              _heldFees[_i].beneficiary
            )
          );
          refundedFees += _feeAmount(leftoverAmount, _heldFees[_i].fee, _heldFees[_i].feeDiscount);
        }
        leftoverAmount = 0;
      }

      unchecked {
        ++_i;
      }
    }

    emit RefundHeldFees(_projectId, _amount, refundedFees, leftoverAmount, msg.sender);
  }

  /** 
    @notice 
    Returns the fee amount based on the provided amount for the specified project.

    @param _amount The amount that the fee is based on, as a fixed point number with the same amount of decimals as this terminal.
    @param _fee The percentage of the fee, out of MAX_FEE. 
    @param _feeDiscount The percentage discount that should be applied out of the max amount, out of MAX_FEE_DISCOUNT.

    @return The amount of the fee, as a fixed point number with the same amount of decimals as this terminal.
  */
  function _feeAmount(
    uint256 _amount,
    uint256 _fee,
    uint256 _feeDiscount
  ) internal pure returns (uint256) {
    // Calculate the discounted fee.
    uint256 _discountedFee = _fee -
      PRBMath.mulDiv(_fee, _feeDiscount, JBConstants.MAX_FEE_DISCOUNT);

    // The amount of tokens from the `_amount` to pay as a fee.
    return
      _amount - PRBMath.mulDiv(_amount, JBConstants.MAX_FEE, _discountedFee + JBConstants.MAX_FEE);
  }

  /** 
    @notice
    Get the fee discount from the fee gauge for the specified project.

    @param _projectId The ID of the project to get a fee discount for.
    
    @return feeDiscount The fee discount, which should be interpreted as a percentage out MAX_FEE_DISCOUNT.
  */
  function _currentFeeDiscount(uint256 _projectId) internal view returns (uint256) {
    // Can't take a fee if the protocol project doesn't have a terminal that accepts the token.
    if (
      directory.primaryTerminalOf(_FEE_BENEFICIARY_PROJECT_ID, token) ==
      IJBPaymentTerminal(address(0))
    ) return JBConstants.MAX_FEE_DISCOUNT;

    // Get the fee discount.
    if (feeGauge != IJBFeeGauge(address(0)))
      // If the guage reverts, keep the discount at 0.
      try feeGauge.currentDiscountFor(_projectId) returns (uint256 discount) {
        // If the fee discount is greater than the max, we ignore the return value
        if (discount <= JBConstants.MAX_FEE_DISCOUNT) return discount;
      } catch {
        return 0;
      }

    return 0;
  }
}

File 9 of 75 : JBSingleTokenPaymentTerminal.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;

import '@openzeppelin/contracts/utils/introspection/ERC165.sol';
import './../interfaces/IJBSingleTokenPaymentTerminal.sol';

/**
  @notice
  Generic terminal managing all inflows of funds into the protocol ecosystem for one token.

  @dev
  Adheres to -
  IJBSingleTokenPaymentTerminals: General interface for the methods in this contract that interact with the blockchain's state according to the protocol's rules.

  @dev
  Inherits from -
  ERC165: Introspection on interface adherance. 
*/
abstract contract JBSingleTokenPaymentTerminal is ERC165, IJBSingleTokenPaymentTerminal {
  //*********************************************************************//
  // ---------------- public immutable stored properties --------------- //
  //*********************************************************************//

  /**
    @notice
    The token that this terminal accepts.
  */
  address public immutable override token;

  /**
    @notice
    The number of decimals the token fixed point amounts are expected to have.
  */
  uint256 public immutable override decimals;

  /**
    @notice
    The currency to use when resolving price feeds for this terminal.
  */
  uint256 public immutable override currency;

  //*********************************************************************//
  // ------------------------- external views -------------------------- //
  //*********************************************************************//

  /** 
    @notice
    A flag indicating if this terminal accepts the specified token.

    @param _token The token to check if this terminal accepts or not.
    @param _projectId The project ID to check for token acceptance.

    @return The flag.
  */
  function acceptsToken(address _token, uint256 _projectId) external view override returns (bool) {
    _projectId; // Prevents unused var compiler and natspec complaints.

    return _token == token;
  }

  /** 
    @notice
    The decimals that should be used in fixed number accounting for the specified token.

    @param _token The token to check for the decimals of.

    @return The number of decimals for the token.
  */
  function decimalsForToken(address _token) external view override returns (uint256) {
    _token; // Prevents unused var compiler and natspec complaints.

    return decimals;
  }

  /** 
    @notice
    The currency that should be used for the specified token.

    @param _token The token to check for the currency of.

    @return The currency index.
  */
  function currencyForToken(address _token) external view override returns (uint256) {
    _token; // Prevents unused var compiler and natspec complaints.

    return currency;
  }

  //*********************************************************************//
  // -------------------------- public views --------------------------- //
  //*********************************************************************//

  /**
    @notice
    Indicates if this contract adheres to the specified interface.

    @dev 
    See {IERC165-supportsInterface}.

    @param _interfaceId The ID of the interface to check for adherance to.
  */
  function supportsInterface(bytes4 _interfaceId)
    public
    view
    virtual
    override(ERC165, IERC165)
    returns (bool)
  {
    return
      _interfaceId == type(IJBPaymentTerminal).interfaceId ||
      _interfaceId == type(IJBSingleTokenPaymentTerminal).interfaceId ||
      super.supportsInterface(_interfaceId);
  }

  //*********************************************************************//
  // -------------------------- constructor ---------------------------- //
  //*********************************************************************//

  /**
    @param _token The token that this terminal manages.
    @param _decimals The number of decimals the token fixed point amounts are expected to have.
    @param _currency The currency that this terminal's token adheres to for price feeds.
  */
  constructor(
    address _token,
    uint256 _decimals,
    uint256 _currency
  ) {
    token = _token;
    decimals = _decimals;
    currency = _currency;
  }
}

File 10 of 75 : JBBallotState.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

enum JBBallotState {
  Active,
  Approved,
  Failed
}

File 11 of 75 : IJBAllowanceTerminal.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IJBAllowanceTerminal {
  function useAllowanceOf(
    uint256 _projectId,
    uint256 _amount,
    uint256 _currency,
    address _token,
    uint256 _minReturnedTokens,
    address payable _beneficiary,
    string calldata _memo
  ) external returns (uint256 netDistributedAmount);
}

File 12 of 75 : IJBController.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import '@openzeppelin/contracts/utils/introspection/IERC165.sol';
import './../structs/JBFundAccessConstraints.sol';
import './../structs/JBFundingCycleData.sol';
import './../structs/JBFundingCycleMetadata.sol';
import './../structs/JBGroupedSplits.sol';
import './../structs/JBProjectMetadata.sol';
import './IJBDirectory.sol';
import './IJBFundingCycleStore.sol';
import './IJBMigratable.sol';
import './IJBPaymentTerminal.sol';
import './IJBSplitsStore.sol';
import './IJBTokenStore.sol';

interface IJBController is IERC165 {
  event LaunchProject(uint256 configuration, uint256 projectId, string memo, address caller);

  event LaunchFundingCycles(uint256 configuration, uint256 projectId, string memo, address caller);

  event ReconfigureFundingCycles(
    uint256 configuration,
    uint256 projectId,
    string memo,
    address caller
  );

  event SetFundAccessConstraints(
    uint256 indexed fundingCycleConfiguration,
    uint256 indexed fundingCycleNumber,
    uint256 indexed projectId,
    JBFundAccessConstraints constraints,
    address caller
  );

  event DistributeReservedTokens(
    uint256 indexed fundingCycleConfiguration,
    uint256 indexed fundingCycleNumber,
    uint256 indexed projectId,
    address beneficiary,
    uint256 tokenCount,
    uint256 beneficiaryTokenCount,
    string memo,
    address caller
  );

  event DistributeToReservedTokenSplit(
    uint256 indexed projectId,
    uint256 indexed domain,
    uint256 indexed group,
    JBSplit split,
    uint256 tokenCount,
    address caller
  );

  event MintTokens(
    address indexed beneficiary,
    uint256 indexed projectId,
    uint256 tokenCount,
    uint256 beneficiaryTokenCount,
    string memo,
    uint256 reservedRate,
    address caller
  );

  event BurnTokens(
    address indexed holder,
    uint256 indexed projectId,
    uint256 tokenCount,
    string memo,
    address caller
  );

  event Migrate(uint256 indexed projectId, IJBMigratable to, address caller);

  event PrepMigration(uint256 indexed projectId, address from, address caller);

  function projects() external view returns (IJBProjects);

  function fundingCycleStore() external view returns (IJBFundingCycleStore);

  function tokenStore() external view returns (IJBTokenStore);

  function splitsStore() external view returns (IJBSplitsStore);

  function directory() external view returns (IJBDirectory);

  function reservedTokenBalanceOf(uint256 _projectId, uint256 _reservedRate)
    external
    view
    returns (uint256);

  function distributionLimitOf(
    uint256 _projectId,
    uint256 _configuration,
    IJBPaymentTerminal _terminal,
    address _token
  ) external view returns (uint256 distributionLimit, uint256 distributionLimitCurrency);

  function overflowAllowanceOf(
    uint256 _projectId,
    uint256 _configuration,
    IJBPaymentTerminal _terminal,
    address _token
  ) external view returns (uint256 overflowAllowance, uint256 overflowAllowanceCurrency);

  function totalOutstandingTokensOf(uint256 _projectId, uint256 _reservedRate)
    external
    view
    returns (uint256);

  function getFundingCycleOf(uint256 _projectId, uint256 _configuration)
    external
    view
    returns (JBFundingCycle memory fundingCycle, JBFundingCycleMetadata memory metadata);

  function latestConfiguredFundingCycleOf(uint256 _projectId)
    external
    view
    returns (
      JBFundingCycle memory,
      JBFundingCycleMetadata memory metadata,
      JBBallotState
    );

  function currentFundingCycleOf(uint256 _projectId)
    external
    view
    returns (JBFundingCycle memory fundingCycle, JBFundingCycleMetadata memory metadata);

  function queuedFundingCycleOf(uint256 _projectId)
    external
    view
    returns (JBFundingCycle memory fundingCycle, JBFundingCycleMetadata memory metadata);

  function launchProjectFor(
    address _owner,
    JBProjectMetadata calldata _projectMetadata,
    JBFundingCycleData calldata _data,
    JBFundingCycleMetadata calldata _metadata,
    uint256 _mustStartAtOrAfter,
    JBGroupedSplits[] memory _groupedSplits,
    JBFundAccessConstraints[] memory _fundAccessConstraints,
    IJBPaymentTerminal[] memory _terminals,
    string calldata _memo
  ) external returns (uint256 projectId);

  function launchFundingCyclesFor(
    uint256 _projectId,
    JBFundingCycleData calldata _data,
    JBFundingCycleMetadata calldata _metadata,
    uint256 _mustStartAtOrAfter,
    JBGroupedSplits[] memory _groupedSplits,
    JBFundAccessConstraints[] memory _fundAccessConstraints,
    IJBPaymentTerminal[] memory _terminals,
    string calldata _memo
  ) external returns (uint256 configuration);

  function reconfigureFundingCyclesOf(
    uint256 _projectId,
    JBFundingCycleData calldata _data,
    JBFundingCycleMetadata calldata _metadata,
    uint256 _mustStartAtOrAfter,
    JBGroupedSplits[] memory _groupedSplits,
    JBFundAccessConstraints[] memory _fundAccessConstraints,
    string calldata _memo
  ) external returns (uint256);

  function mintTokensOf(
    uint256 _projectId,
    uint256 _tokenCount,
    address _beneficiary,
    string calldata _memo,
    bool _preferClaimedTokens,
    bool _useReservedRate
  ) external returns (uint256 beneficiaryTokenCount);

  function burnTokensOf(
    address _holder,
    uint256 _projectId,
    uint256 _tokenCount,
    string calldata _memo,
    bool _preferClaimedTokens
  ) external;

  function distributeReservedTokensOf(uint256 _projectId, string memory _memo)
    external
    returns (uint256);

  function migrate(uint256 _projectId, IJBMigratable _to) external;
}

File 13 of 75 : IJBController3_0_1.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import '@openzeppelin/contracts/utils/introspection/IERC165.sol';
import './../structs/JBFundAccessConstraints.sol';
import './../structs/JBFundingCycleData.sol';
import './../structs/JBFundingCycleMetadata.sol';
import './../structs/JBGroupedSplits.sol';
import './../structs/JBProjectMetadata.sol';
import './IJBController.sol';
import './IJBDirectory.sol';
import './IJBFundingCycleStore.sol';
import './IJBMigratable.sol';
import './IJBPaymentTerminal.sol';
import './IJBSplitsStore.sol';
import './IJBTokenStore.sol';

interface IJBController3_0_1 {
  function reservedTokenBalanceOf(uint256 _projectId) external view returns (uint256);
  function totalOutstandingTokensOf(uint256 _projectId) external view returns (uint256);
}

File 14 of 75 : IJBController3_1.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import '@openzeppelin/contracts/utils/introspection/IERC165.sol';
import './../structs/JBFundAccessConstraints.sol';
import './../structs/JBFundingCycleData.sol';
import './../structs/JBFundingCycleMetadata.sol';
import './../structs/JBGroupedSplits.sol';
import './../structs/JBProjectMetadata.sol';
import './IJBController3_0_1.sol';
import './IJBDirectory.sol';
import './IJBFundAccessConstraintsStore.sol';
import './IJBFundingCycleStore.sol';
import './IJBMigratable.sol';
import './IJBPaymentTerminal.sol';
import './IJBSplitsStore.sol';
import './IJBTokenStore.sol';

interface IJBController3_1 is IJBController3_0_1, IERC165 {
  event LaunchProject(uint256 configuration, uint256 projectId, string memo, address caller);

  event LaunchFundingCycles(uint256 configuration, uint256 projectId, string memo, address caller);

  event ReconfigureFundingCycles(
    uint256 configuration,
    uint256 projectId,
    string memo,
    address caller
  );

  event DistributeReservedTokens(
    uint256 indexed fundingCycleConfiguration,
    uint256 indexed fundingCycleNumber,
    uint256 indexed projectId,
    address beneficiary,
    uint256 tokenCount,
    uint256 beneficiaryTokenCount,
    string memo,
    address caller
  );

  event DistributeToReservedTokenSplit(
    uint256 indexed projectId,
    uint256 indexed domain,
    uint256 indexed group,
    JBSplit split,
    uint256 tokenCount,
    address caller
  );

  event MintTokens(
    address indexed beneficiary,
    uint256 indexed projectId,
    uint256 tokenCount,
    uint256 beneficiaryTokenCount,
    string memo,
    uint256 reservedRate,
    address caller
  );

  event BurnTokens(
    address indexed holder,
    uint256 indexed projectId,
    uint256 tokenCount,
    string memo,
    address caller
  );

  event Migrate(uint256 indexed projectId, IJBMigratable to, address caller);

  event PrepMigration(uint256 indexed projectId, address from, address caller);

  function projects() external view returns (IJBProjects);

  function fundingCycleStore() external view returns (IJBFundingCycleStore);

  function tokenStore() external view returns (IJBTokenStore);

  function splitsStore() external view returns (IJBSplitsStore);

  function fundAccessConstraintsStore() external view returns (IJBFundAccessConstraintsStore);

  function directory() external view returns (IJBDirectory);

  function reservedTokenBalanceOf(uint256 _projectId) external view returns (uint256);

  function totalOutstandingTokensOf(uint256 _projectId) external view returns (uint256);

  function getFundingCycleOf(uint256 _projectId, uint256 _configuration)
    external
    view
    returns (JBFundingCycle memory fundingCycle, JBFundingCycleMetadata memory metadata);

  function latestConfiguredFundingCycleOf(uint256 _projectId)
    external
    view
    returns (
      JBFundingCycle memory,
      JBFundingCycleMetadata memory metadata,
      JBBallotState
    );

  function currentFundingCycleOf(uint256 _projectId)
    external
    view
    returns (JBFundingCycle memory fundingCycle, JBFundingCycleMetadata memory metadata);

  function queuedFundingCycleOf(uint256 _projectId)
    external
    view
    returns (JBFundingCycle memory fundingCycle, JBFundingCycleMetadata memory metadata);

  function launchProjectFor(
    address _owner,
    JBProjectMetadata calldata _projectMetadata,
    JBFundingCycleData calldata _data,
    JBFundingCycleMetadata calldata _metadata,
    uint256 _mustStartAtOrAfter,
    JBGroupedSplits[] memory _groupedSplits,
    JBFundAccessConstraints[] memory _fundAccessConstraints,
    IJBPaymentTerminal[] memory _terminals,
    string calldata _memo
  ) external returns (uint256 projectId);

  function launchFundingCyclesFor(
    uint256 _projectId,
    JBFundingCycleData calldata _data,
    JBFundingCycleMetadata calldata _metadata,
    uint256 _mustStartAtOrAfter,
    JBGroupedSplits[] memory _groupedSplits,
    JBFundAccessConstraints[] memory _fundAccessConstraints,
    IJBPaymentTerminal[] memory _terminals,
    string calldata _memo
  ) external returns (uint256 configuration);

  function reconfigureFundingCyclesOf(
    uint256 _projectId,
    JBFundingCycleData calldata _data,
    JBFundingCycleMetadata calldata _metadata,
    uint256 _mustStartAtOrAfter,
    JBGroupedSplits[] memory _groupedSplits,
    JBFundAccessConstraints[] memory _fundAccessConstraints,
    string calldata _memo
  ) external returns (uint256);

  function mintTokensOf(
    uint256 _projectId,
    uint256 _tokenCount,
    address _beneficiary,
    string calldata _memo,
    bool _preferClaimedTokens,
    bool _useReservedRate
  ) external returns (uint256 beneficiaryTokenCount);

  function burnTokensOf(
    address _holder,
    uint256 _projectId,
    uint256 _tokenCount,
    string calldata _memo,
    bool _preferClaimedTokens
  ) external;

  function distributeReservedTokensOf(uint256 _projectId, string memory _memo)
    external
    returns (uint256);

  function migrate(uint256 _projectId, IJBMigratable _to) external;
}

File 15 of 75 : IJBDirectory.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import './IJBFundingCycleStore.sol';
import './IJBPaymentTerminal.sol';
import './IJBProjects.sol';

interface IJBDirectory {
  event SetController(uint256 indexed projectId, address indexed controller, address caller);

  event AddTerminal(uint256 indexed projectId, IJBPaymentTerminal indexed terminal, address caller);

  event SetTerminals(uint256 indexed projectId, IJBPaymentTerminal[] terminals, address caller);

  event SetPrimaryTerminal(
    uint256 indexed projectId,
    address indexed token,
    IJBPaymentTerminal indexed terminal,
    address caller
  );

  event SetIsAllowedToSetFirstController(address indexed addr, bool indexed flag, address caller);

  function projects() external view returns (IJBProjects);

  function fundingCycleStore() external view returns (IJBFundingCycleStore);

  function controllerOf(uint256 _projectId) external view returns (address);

  function isAllowedToSetFirstController(address _address) external view returns (bool);

  function terminalsOf(uint256 _projectId) external view returns (IJBPaymentTerminal[] memory);

  function isTerminalOf(uint256 _projectId, IJBPaymentTerminal _terminal)
    external
    view
    returns (bool);

  function primaryTerminalOf(uint256 _projectId, address _token)
    external
    view
    returns (IJBPaymentTerminal);

  function setControllerOf(uint256 _projectId, address _controller) external;

  function setTerminalsOf(uint256 _projectId, IJBPaymentTerminal[] calldata _terminals) external;

  function setPrimaryTerminalOf(
    uint256 _projectId,
    address _token,
    IJBPaymentTerminal _terminal
  ) external;

  function setIsAllowedToSetFirstController(address _address, bool _flag) external;
}

File 16 of 75 : IJBFeeGauge.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IJBFeeGauge {
  function currentDiscountFor(uint256 _projectId) external view returns (uint256);
}

File 17 of 75 : IJBFundAccessConstraintsStore.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

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

interface IJBFundAccessConstraintsStore is IERC165 {
  event SetFundAccessConstraints(
    uint256 indexed fundingCycleConfiguration,
    uint256 indexed projectId,
    JBFundAccessConstraints constraints,
    address caller
  );

  function distributionLimitOf(
    uint256 _projectId,
    uint256 _configuration,
    IJBPaymentTerminal _terminal,
    address _token
  ) external view returns (uint256 distributionLimit, uint256 distributionLimitCurrency);

  function overflowAllowanceOf(
    uint256 _projectId,
    uint256 _configuration,
    IJBPaymentTerminal _terminal,
    address _token
  ) external view returns (uint256 overflowAllowance, uint256 overflowAllowanceCurrency);

  function setFor(
    uint256 _projectId,
    uint256 _configuration,
    JBFundAccessConstraints[] memory _fundAccessConstaints
  ) external;
}

File 18 of 75 : IJBFundingCycleBallot.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

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

interface IJBFundingCycleBallot is IERC165 {
  function duration() external view returns (uint256);

  function stateOf(
    uint256 _projectId,
    uint256 _configuration,
    uint256 _start
  ) external view returns (JBBallotState);
}

File 19 of 75 : IJBFundingCycleStore.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import './../enums/JBBallotState.sol';
import './../structs/JBFundingCycle.sol';
import './../structs/JBFundingCycleData.sol';

interface IJBFundingCycleStore {
  event Configure(
    uint256 indexed configuration,
    uint256 indexed projectId,
    JBFundingCycleData data,
    uint256 metadata,
    uint256 mustStartAtOrAfter,
    address caller
  );

  event Init(uint256 indexed configuration, uint256 indexed projectId, uint256 indexed basedOn);

  function latestConfigurationOf(uint256 _projectId) external view returns (uint256);

  function get(uint256 _projectId, uint256 _configuration)
    external
    view
    returns (JBFundingCycle memory);

  function latestConfiguredOf(uint256 _projectId)
    external
    view
    returns (JBFundingCycle memory fundingCycle, JBBallotState ballotState);

  function queuedOf(uint256 _projectId) external view returns (JBFundingCycle memory fundingCycle);

  function currentOf(uint256 _projectId) external view returns (JBFundingCycle memory fundingCycle);

  function currentBallotStateOf(uint256 _projectId) external view returns (JBBallotState);

  function configureFor(
    uint256 _projectId,
    JBFundingCycleData calldata _data,
    uint256 _metadata,
    uint256 _mustStartAtOrAfter
  ) external returns (JBFundingCycle memory fundingCycle);
}

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

interface IJBMigratable {
  function prepForMigrationOf(uint256 _projectId, address _from) external;
}

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

import './IJBOperatorStore.sol';

interface IJBOperatable {
  function operatorStore() external view returns (IJBOperatorStore);
}

File 22 of 75 : IJBOperatorStore.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import './../structs/JBOperatorData.sol';

interface IJBOperatorStore {
  event SetOperator(
    address indexed operator,
    address indexed account,
    uint256 indexed domain,
    uint256[] permissionIndexes,
    uint256 packed
  );

  function permissionsOf(
    address _operator,
    address _account,
    uint256 _domain
  ) external view returns (uint256);

  function hasPermission(
    address _operator,
    address _account,
    uint256 _domain,
    uint256 _permissionIndex
  ) external view returns (bool);

  function hasPermissions(
    address _operator,
    address _account,
    uint256 _domain,
    uint256[] calldata _permissionIndexes
  ) external view returns (bool);

  function setOperator(JBOperatorData calldata _operatorData) external;

  function setOperators(JBOperatorData[] calldata _operatorData) external;
}

File 23 of 75 : IJBPayDelegate.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

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

/**
  @title
  Pay delegate

  @notice
  Delegate called after JBTerminal.pay(..) logic completion (if passed by the funding cycle datasource)

  @dev
  Adheres to:
  IERC165 for adequate interface integration
*/
interface IJBPayDelegate is IERC165 {
  /**
    @notice
    This function is called by JBPaymentTerminal.pay(..), after the execution of its logic

    @dev
    Critical business logic should be protected by an appropriate access control
    
    @param _data the data passed by the terminal, as a JBDidPayData struct:
                  address payer;
                  uint256 projectId;
                  uint256 currentFundingCycleConfiguration;
                  JBTokenAmount amount;
                  JBTokenAmount forwardedAmount;
                  uint256 projectTokenCount;
                  address beneficiary;
                  bool preferClaimedTokens;
                  string memo;
                  bytes metadata;
  */
  function didPay(JBDidPayData calldata _data) external payable;
}

File 24 of 75 : IJBPaymentTerminal.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

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

interface IJBPaymentTerminal is IERC165 {
  function acceptsToken(address _token, uint256 _projectId) external view returns (bool);

  function currencyForToken(address _token) external view returns (uint256);

  function decimalsForToken(address _token) external view returns (uint256);

  // Return value must be a fixed point number with 18 decimals.
  function currentEthOverflowOf(uint256 _projectId) external view returns (uint256);

  function pay(
    uint256 _projectId,
    uint256 _amount,
    address _token,
    address _beneficiary,
    uint256 _minReturnedTokens,
    bool _preferClaimedTokens,
    string calldata _memo,
    bytes calldata _metadata
  ) external payable returns (uint256 beneficiaryTokenCount);

  function addToBalanceOf(
    uint256 _projectId,
    uint256 _amount,
    address _token,
    string calldata _memo,
    bytes calldata _metadata
  ) external payable;
}

File 25 of 75 : IJBPayoutRedemptionPaymentTerminal.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import './../structs/JBFee.sol';
import './IJBAllowanceTerminal.sol';
import './IJBDirectory.sol';
import './IJBFeeGauge.sol';
import './IJBPayDelegate.sol';
import './IJBPaymentTerminal.sol';
import './IJBPayoutTerminal.sol';
import './IJBPrices.sol';
import './IJBProjects.sol';
import './IJBRedemptionDelegate.sol';
import './IJBRedemptionTerminal.sol';
import './IJBSingleTokenPaymentTerminalStore.sol';
import './IJBSplitsStore.sol';

interface IJBPayoutRedemptionPaymentTerminal is
  IJBPaymentTerminal,
  IJBPayoutTerminal,
  IJBAllowanceTerminal,
  IJBRedemptionTerminal
{
  event AddToBalance(
    uint256 indexed projectId,
    uint256 amount,
    uint256 refundedFees,
    string memo,
    bytes metadata,
    address caller
  );

  event Migrate(
    uint256 indexed projectId,
    IJBPaymentTerminal indexed to,
    uint256 amount,
    address caller
  );

  event DistributePayouts(
    uint256 indexed fundingCycleConfiguration,
    uint256 indexed fundingCycleNumber,
    uint256 indexed projectId,
    address beneficiary,
    uint256 amount,
    uint256 distributedAmount,
    uint256 fee,
    uint256 beneficiaryDistributionAmount,
    string memo,
    address caller
  );

  event UseAllowance(
    uint256 indexed fundingCycleConfiguration,
    uint256 indexed fundingCycleNumber,
    uint256 indexed projectId,
    address beneficiary,
    uint256 amount,
    uint256 distributedAmount,
    uint256 netDistributedamount,
    string memo,
    address caller
  );

  event HoldFee(
    uint256 indexed projectId,
    uint256 indexed amount,
    uint256 indexed fee,
    uint256 feeDiscount,
    address beneficiary,
    address caller
  );

  event ProcessFee(
    uint256 indexed projectId,
    uint256 indexed amount,
    bool indexed wasHeld,
    address beneficiary,
    address caller
  );

  event RefundHeldFees(
    uint256 indexed projectId,
    uint256 indexed amount,
    uint256 indexed refundedFees,
    uint256 leftoverAmount,
    address caller
  );

  event Pay(
    uint256 indexed fundingCycleConfiguration,
    uint256 indexed fundingCycleNumber,
    uint256 indexed projectId,
    address payer,
    address beneficiary,
    uint256 amount,
    uint256 beneficiaryTokenCount,
    string memo,
    bytes metadata,
    address caller
  );

  event DelegateDidPay(
    IJBPayDelegate indexed delegate,
    JBDidPayData data,
    uint256 delegatedAmount,
    address caller
  );

  event RedeemTokens(
    uint256 indexed fundingCycleConfiguration,
    uint256 indexed fundingCycleNumber,
    uint256 indexed projectId,
    address holder,
    address beneficiary,
    uint256 tokenCount,
    uint256 reclaimedAmount,
    string memo,
    bytes metadata,
    address caller
  );

  event DelegateDidRedeem(
    IJBRedemptionDelegate indexed delegate,
    JBDidRedeemData data,
    uint256 delegatedAmount,
    address caller
  );

  event DistributeToPayoutSplit(
    uint256 indexed projectId,
    uint256 indexed domain,
    uint256 indexed group,
    JBSplit split,
    uint256 amount,
    address caller
  );

  event SetFee(uint256 fee, address caller);

  event SetFeeGauge(IJBFeeGauge indexed feeGauge, address caller);

  event SetFeelessAddress(address indexed addrs, bool indexed flag, address caller);

  function projects() external view returns (IJBProjects);

  function splitsStore() external view returns (IJBSplitsStore);

  function directory() external view returns (IJBDirectory);

  function prices() external view returns (IJBPrices);

  function store() external view returns (IJBSingleTokenPaymentTerminalStore);

  function baseWeightCurrency() external view returns (uint256);

  function payoutSplitsGroup() external view returns (uint256);

  function heldFeesOf(uint256 _projectId) external view returns (JBFee[] memory);

  function fee() external view returns (uint256);

  function feeGauge() external view returns (IJBFeeGauge);

  function isFeelessAddress(address _contract) external view returns (bool);

  function migrate(uint256 _projectId, IJBPaymentTerminal _to) external returns (uint256 balance);

  function processFees(uint256 _projectId) external;

  function setFee(uint256 _fee) external;

  function setFeeGauge(IJBFeeGauge _feeGauge) external;

  function setFeelessAddress(address _contract, bool _flag) external;
}

File 26 of 75 : IJBPayoutTerminal.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IJBPayoutTerminal {
  function distributePayoutsOf(
    uint256 _projectId,
    uint256 _amount,
    uint256 _currency,
    address _token,
    uint256 _minReturnedTokens,
    string calldata _memo
  ) external returns (uint256 netLeftoverDistributionAmount);
}

File 27 of 75 : IJBPriceFeed.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IJBPriceFeed {
  function currentPrice(uint256 _targetDecimals) external view returns (uint256);
}

File 28 of 75 : IJBPrices.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import './IJBPriceFeed.sol';

interface IJBPrices {
  event AddFeed(uint256 indexed currency, uint256 indexed base, IJBPriceFeed feed);

  function feedFor(uint256 _currency, uint256 _base) external view returns (IJBPriceFeed);

  function priceFor(
    uint256 _currency,
    uint256 _base,
    uint256 _decimals
  ) external view returns (uint256);

  function addFeedFor(
    uint256 _currency,
    uint256 _base,
    IJBPriceFeed _priceFeed
  ) external;
}

File 29 of 75 : IJBProjects.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import '@openzeppelin/contracts/token/ERC721/IERC721.sol';
import './../structs/JBProjectMetadata.sol';
import './IJBTokenUriResolver.sol';

interface IJBProjects is IERC721 {
  event Create(
    uint256 indexed projectId,
    address indexed owner,
    JBProjectMetadata metadata,
    address caller
  );

  event SetMetadata(uint256 indexed projectId, JBProjectMetadata metadata, address caller);

  event SetTokenUriResolver(IJBTokenUriResolver indexed resolver, address caller);

  function count() external view returns (uint256);

  function metadataContentOf(uint256 _projectId, uint256 _domain)
    external
    view
    returns (string memory);

  function tokenUriResolver() external view returns (IJBTokenUriResolver);

  function createFor(address _owner, JBProjectMetadata calldata _metadata)
    external
    returns (uint256 projectId);

  function setMetadataOf(uint256 _projectId, JBProjectMetadata calldata _metadata) external;

  function setTokenUriResolver(IJBTokenUriResolver _newResolver) external;
}

File 30 of 75 : IJBRedemptionDelegate.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

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

/**
  @title
  Redemption delegate

  @notice
  Delegate called after JBTerminal.redeemTokensOf(..) logic completion (if passed by the funding cycle datasource)

  @dev
  Adheres to:
  IERC165 for adequate interface integration
*/
interface IJBRedemptionDelegate is IERC165 {
  /**
    @notice
    This function is called by JBPaymentTerminal.redeemTokensOf(..), after the execution of its logic

    @dev
    Critical business logic should be protected by an appropriate access control
    
    @param _data the data passed by the terminal, as a JBDidRedeemData struct:
                address holder;
                uint256 projectId;
                uint256 currentFundingCycleConfiguration;
                uint256 projectTokenCount;
                JBTokenAmount reclaimedAmount;
                JBTokenAmount forwardedAmount;
                address payable beneficiary;
                string memo;
                bytes metadata;
  */
  function didRedeem(JBDidRedeemData calldata _data) external payable;
}

File 31 of 75 : IJBRedemptionTerminal.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IJBRedemptionTerminal {
  function redeemTokensOf(
    address _holder,
    uint256 _projectId,
    uint256 _tokenCount,
    address _token,
    uint256 _minReturnedTokens,
    address payable _beneficiary,
    string calldata _memo,
    bytes calldata _metadata
  ) external returns (uint256 reclaimAmount);
}

File 32 of 75 : IJBSingleTokenPaymentTerminal.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import './IJBPaymentTerminal.sol';

interface IJBSingleTokenPaymentTerminal is IJBPaymentTerminal {
  function token() external view returns (address);

  function currency() external view returns (uint256);

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

File 33 of 75 : IJBSingleTokenPaymentTerminalStore.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import './../structs/JBFundingCycle.sol';
import './../structs/JBPayDelegateAllocation.sol';
import './../structs/JBRedemptionDelegateAllocation.sol';
import './../structs/JBTokenAmount.sol';
import './IJBDirectory.sol';
import './IJBFundingCycleStore.sol';
import './IJBPrices.sol';
import './IJBSingleTokenPaymentTerminal.sol';

interface IJBSingleTokenPaymentTerminalStore {
  function fundingCycleStore() external view returns (IJBFundingCycleStore);

  function directory() external view returns (IJBDirectory);

  function prices() external view returns (IJBPrices);

  function balanceOf(IJBSingleTokenPaymentTerminal _terminal, uint256 _projectId)
    external
    view
    returns (uint256);

  function usedDistributionLimitOf(
    IJBSingleTokenPaymentTerminal _terminal,
    uint256 _projectId,
    uint256 _fundingCycleNumber
  ) external view returns (uint256);

  function usedOverflowAllowanceOf(
    IJBSingleTokenPaymentTerminal _terminal,
    uint256 _projectId,
    uint256 _fundingCycleConfiguration
  ) external view returns (uint256);

  function currentOverflowOf(IJBSingleTokenPaymentTerminal _terminal, uint256 _projectId)
    external
    view
    returns (uint256);

  function currentTotalOverflowOf(
    uint256 _projectId,
    uint256 _decimals,
    uint256 _currency
  ) external view returns (uint256);

  function currentReclaimableOverflowOf(
    IJBSingleTokenPaymentTerminal _terminal,
    uint256 _projectId,
    uint256 _tokenCount,
    bool _useTotalOverflow
  ) external view returns (uint256);

  function currentReclaimableOverflowOf(
    uint256 _projectId,
    uint256 _tokenCount,
    uint256 _totalSupply,
    uint256 _overflow
  ) external view returns (uint256);

  function recordPaymentFrom(
    address _payer,
    JBTokenAmount memory _amount,
    uint256 _projectId,
    uint256 _baseWeightCurrency,
    address _beneficiary,
    string calldata _memo,
    bytes calldata _metadata
  )
    external
    returns (
      JBFundingCycle memory fundingCycle,
      uint256 tokenCount,
      JBPayDelegateAllocation[] memory delegateAllocations,
      string memory memo
    );

  function recordRedemptionFor(
    address _holder,
    uint256 _projectId,
    uint256 _tokenCount,
    string calldata _memo,
    bytes calldata _metadata
  )
    external
    returns (
      JBFundingCycle memory fundingCycle,
      uint256 reclaimAmount,
      JBRedemptionDelegateAllocation[] memory delegateAllocations,
      string memory memo
    );

  function recordDistributionFor(
    uint256 _projectId,
    uint256 _amount,
    uint256 _currency
  ) external returns (JBFundingCycle memory fundingCycle, uint256 distributedAmount);

  function recordUsedAllowanceOf(
    uint256 _projectId,
    uint256 _amount,
    uint256 _currency
  ) external returns (JBFundingCycle memory fundingCycle, uint256 withdrawnAmount);

  function recordAddedBalanceFor(uint256 _projectId, uint256 _amount) external;

  function recordMigration(uint256 _projectId) external returns (uint256 balance);
}

File 34 of 75 : IJBSplitAllocator.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

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

/**
  @title
  Split allocator

  @notice
  Provide a way to process a single split with extra logic

  @dev
  Adheres to:
  IERC165 for adequate interface integration

  @dev
  The contract address should be set as an allocator in the adequate split
*/
interface IJBSplitAllocator is IERC165 {
  /**
    @notice
    This function is called by JBPaymentTerminal.distributePayoutOf(..), during the processing of the split including it

    @dev
    Critical business logic should be protected by an appropriate access control. The token and/or eth are optimistically transfered
    to the allocator for its logic.
    
    @param _data the data passed by the terminal, as a JBSplitAllocationData struct:
                  address token;
                  uint256 amount;
                  uint256 decimals;
                  uint256 projectId;
                  uint256 group;
                  JBSplit split;
  */
  function allocate(JBSplitAllocationData calldata _data) external payable;
}

File 35 of 75 : IJBSplitsStore.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import './../structs/JBGroupedSplits.sol';
import './../structs/JBSplit.sol';
import './IJBDirectory.sol';
import './IJBProjects.sol';

interface IJBSplitsStore {
  event SetSplit(
    uint256 indexed projectId,
    uint256 indexed domain,
    uint256 indexed group,
    JBSplit split,
    address caller
  );

  function projects() external view returns (IJBProjects);

  function directory() external view returns (IJBDirectory);

  function splitsOf(
    uint256 _projectId,
    uint256 _domain,
    uint256 _group
  ) external view returns (JBSplit[] memory);

  function set(
    uint256 _projectId,
    uint256 _domain,
    JBGroupedSplits[] memory _groupedSplits
  ) external;
}

File 36 of 75 : IJBToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IJBToken {
  function projectId() external view returns (uint256);

  function decimals() external view returns (uint8);

  function totalSupply(uint256 _projectId) external view returns (uint256);

  function balanceOf(address _account, uint256 _projectId) external view returns (uint256);

  function mint(
    uint256 _projectId,
    address _account,
    uint256 _amount
  ) external;

  function burn(
    uint256 _projectId,
    address _account,
    uint256 _amount
  ) external;

  function approve(
    uint256,
    address _spender,
    uint256 _amount
  ) external;

  function transfer(
    uint256 _projectId,
    address _to,
    uint256 _amount
  ) external;

  function transferFrom(
    uint256 _projectId,
    address _from,
    address _to,
    uint256 _amount
  ) external;
}

File 37 of 75 : IJBTokenStore.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import './IJBFundingCycleStore.sol';
import './IJBProjects.sol';
import './IJBToken.sol';

interface IJBTokenStore {
  event Issue(
    uint256 indexed projectId,
    IJBToken indexed token,
    string name,
    string symbol,
    address caller
  );

  event Mint(
    address indexed holder,
    uint256 indexed projectId,
    uint256 amount,
    bool tokensWereClaimed,
    bool preferClaimedTokens,
    address caller
  );

  event Burn(
    address indexed holder,
    uint256 indexed projectId,
    uint256 amount,
    uint256 initialUnclaimedBalance,
    uint256 initialClaimedBalance,
    bool preferClaimedTokens,
    address caller
  );

  event Claim(
    address indexed holder,
    uint256 indexed projectId,
    uint256 initialUnclaimedBalance,
    uint256 amount,
    address caller
  );

  event Set(uint256 indexed projectId, IJBToken indexed newToken, address caller);

  event Transfer(
    address indexed holder,
    uint256 indexed projectId,
    address indexed recipient,
    uint256 amount,
    address caller
  );

  function tokenOf(uint256 _projectId) external view returns (IJBToken);

  function projects() external view returns (IJBProjects);

  function fundingCycleStore() external view returns (IJBFundingCycleStore);

  function unclaimedBalanceOf(address _holder, uint256 _projectId) external view returns (uint256);

  function unclaimedTotalSupplyOf(uint256 _projectId) external view returns (uint256);

  function totalSupplyOf(uint256 _projectId) external view returns (uint256);

  function balanceOf(address _holder, uint256 _projectId) external view returns (uint256 _result);

  function issueFor(
    uint256 _projectId,
    string calldata _name,
    string calldata _symbol
  ) external returns (IJBToken token);

  function setFor(uint256 _projectId, IJBToken _token) external;

  function burnFrom(
    address _holder,
    uint256 _projectId,
    uint256 _amount,
    bool _preferClaimedTokens
  ) external;

  function mintFor(
    address _holder,
    uint256 _projectId,
    uint256 _amount,
    bool _preferClaimedTokens
  ) external;

  function claimFor(
    address _holder,
    uint256 _projectId,
    uint256 _amount
  ) external;

  function transferFrom(
    address _holder,
    uint256 _projectId,
    address _recipient,
    uint256 _amount
  ) external;
}

File 38 of 75 : IJBTokenUriResolver.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IJBTokenUriResolver {
  function getUri(uint256 _projectId) external view returns (string memory tokenUri);
}

File 39 of 75 : JBConstants.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/**
  @notice
  Global constants used across Juicebox contracts.
*/
library JBConstants {
  uint256 public constant MAX_RESERVED_RATE = 10_000;
  uint256 public constant MAX_REDEMPTION_RATE = 10_000;
  uint256 public constant MAX_DISCOUNT_RATE = 1_000_000_000;
  uint256 public constant SPLITS_TOTAL_PERCENT = 1_000_000_000;
  uint256 public constant MAX_FEE = 1_000_000_000;
  uint256 public constant MAX_FEE_DISCOUNT = 1_000_000_000;
}

File 40 of 75 : JBCurrencies.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

library JBCurrencies {
  uint256 public constant ETH = 1;
  uint256 public constant USD = 2;
}

File 41 of 75 : JBFixedPointNumber.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;

library JBFixedPointNumber {
  function adjustDecimals(
    uint256 _value,
    uint256 _decimals,
    uint256 _targetDecimals
  ) internal pure returns (uint256) {
    // If decimals need adjusting, multiply or divide the price by the decimal adjuster to get the normalized result.
    if (_targetDecimals == _decimals) return _value;
    else if (_targetDecimals > _decimals) return _value * 10**(_targetDecimals - _decimals);
    else return _value / 10**(_decimals - _targetDecimals);
  }
}

File 42 of 75 : JBFundingCycleMetadataResolver.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;

import './../structs/JBFundingCycle.sol';
import './../structs/JBFundingCycleMetadata.sol';
import './../structs/JBGlobalFundingCycleMetadata.sol';
import './JBConstants.sol';
import './JBGlobalFundingCycleMetadataResolver.sol';

library JBFundingCycleMetadataResolver {
  function global(JBFundingCycle memory _fundingCycle)
    internal
    pure
    returns (JBGlobalFundingCycleMetadata memory)
  {
    return JBGlobalFundingCycleMetadataResolver.expandMetadata(uint8(_fundingCycle.metadata >> 8));
  }

  function reservedRate(JBFundingCycle memory _fundingCycle) internal pure returns (uint256) {
    return uint256(uint16(_fundingCycle.metadata >> 24));
  }

  function redemptionRate(JBFundingCycle memory _fundingCycle) internal pure returns (uint256) {
    // Redemption rate is a number 0-10000. It's inverse was stored so the most common case of 100% results in no storage needs.
    return JBConstants.MAX_REDEMPTION_RATE - uint256(uint16(_fundingCycle.metadata >> 40));
  }

  function ballotRedemptionRate(JBFundingCycle memory _fundingCycle)
    internal
    pure
    returns (uint256)
  {
    // Redemption rate is a number 0-10000. It's inverse was stored so the most common case of 100% results in no storage needs.
    return JBConstants.MAX_REDEMPTION_RATE - uint256(uint16(_fundingCycle.metadata >> 56));
  }

  function payPaused(JBFundingCycle memory _fundingCycle) internal pure returns (bool) {
    return ((_fundingCycle.metadata >> 72) & 1) == 1;
  }

  function distributionsPaused(JBFundingCycle memory _fundingCycle) internal pure returns (bool) {
    return ((_fundingCycle.metadata >> 73) & 1) == 1;
  }

  function redeemPaused(JBFundingCycle memory _fundingCycle) internal pure returns (bool) {
    return ((_fundingCycle.metadata >> 74) & 1) == 1;
  }

  function burnPaused(JBFundingCycle memory _fundingCycle) internal pure returns (bool) {
    return ((_fundingCycle.metadata >> 75) & 1) == 1;
  }

  function mintingAllowed(JBFundingCycle memory _fundingCycle) internal pure returns (bool) {
    return ((_fundingCycle.metadata >> 76) & 1) == 1;
  }

  function terminalMigrationAllowed(JBFundingCycle memory _fundingCycle)
    internal
    pure
    returns (bool)
  {
    return ((_fundingCycle.metadata >> 77) & 1) == 1;
  }

  function controllerMigrationAllowed(JBFundingCycle memory _fundingCycle)
    internal
    pure
    returns (bool)
  {
    return ((_fundingCycle.metadata >> 78) & 1) == 1;
  }

  function shouldHoldFees(JBFundingCycle memory _fundingCycle) internal pure returns (bool) {
    return ((_fundingCycle.metadata >> 79) & 1) == 1;
  }

  function preferClaimedTokenOverride(JBFundingCycle memory _fundingCycle)
    internal
    pure
    returns (bool)
  {
    return ((_fundingCycle.metadata >> 80) & 1) == 1;
  }

  function useTotalOverflowForRedemptions(JBFundingCycle memory _fundingCycle)
    internal
    pure
    returns (bool)
  {
    return ((_fundingCycle.metadata >> 81) & 1) == 1;
  }

  function useDataSourceForPay(JBFundingCycle memory _fundingCycle) internal pure returns (bool) {
    return (_fundingCycle.metadata >> 82) & 1 == 1;
  }

  function useDataSourceForRedeem(JBFundingCycle memory _fundingCycle)
    internal
    pure
    returns (bool)
  {
    return (_fundingCycle.metadata >> 83) & 1 == 1;
  }

  function dataSource(JBFundingCycle memory _fundingCycle) internal pure returns (address) {
    return address(uint160(_fundingCycle.metadata >> 84));
  }

  function metadata(JBFundingCycle memory _fundingCycle) internal pure returns (uint256) {
    return uint256(uint8(_fundingCycle.metadata >> 244));
  }

  /**
    @notice
    Pack the funding cycle metadata.

    @param _metadata The metadata to validate and pack.

    @return packed The packed uint256 of all metadata params. The first 8 bits specify the version.
  */
  function packFundingCycleMetadata(JBFundingCycleMetadata memory _metadata)
    internal
    pure
    returns (uint256 packed)
  {
    // version 1 in the bits 0-7 (8 bits).
    packed = 1;
    // global metadta in bits 8-23 (16 bits).
    packed |=
      JBGlobalFundingCycleMetadataResolver.packFundingCycleGlobalMetadata(_metadata.global) <<
      8;
    // reserved rate in bits 24-39 (16 bits).
    packed |= _metadata.reservedRate << 24;
    // redemption rate in bits 40-55 (16 bits).
    // redemption rate is a number 0-10000. Store the reverse so the most common case of 100% results in no storage needs.
    packed |= (JBConstants.MAX_REDEMPTION_RATE - _metadata.redemptionRate) << 40;
    // ballot redemption rate rate in bits 56-71 (16 bits).
    // ballot redemption rate is a number 0-10000. Store the reverse so the most common case of 100% results in no storage needs.
    packed |= (JBConstants.MAX_REDEMPTION_RATE - _metadata.ballotRedemptionRate) << 56;
    // pause pay in bit 72.
    if (_metadata.pausePay) packed |= 1 << 72;
    // pause tap in bit 73.
    if (_metadata.pauseDistributions) packed |= 1 << 73;
    // pause redeem in bit 74.
    if (_metadata.pauseRedeem) packed |= 1 << 74;
    // pause burn in bit 75.
    if (_metadata.pauseBurn) packed |= 1 << 75;
    // allow minting in bit 76.
    if (_metadata.allowMinting) packed |= 1 << 76;
    // allow terminal migration in bit 77.
    if (_metadata.allowTerminalMigration) packed |= 1 << 77;
    // allow controller migration in bit 78.
    if (_metadata.allowControllerMigration) packed |= 1 << 78;
    // hold fees in bit 79.
    if (_metadata.holdFees) packed |= 1 << 79;
    // prefer claimed token override in bit 80.
    if (_metadata.preferClaimedTokenOverride) packed |= 1 << 80;
    // useTotalOverflowForRedemptions in bit 81.
    if (_metadata.useTotalOverflowForRedemptions) packed |= 1 << 81;
    // use pay data source in bit 82.
    if (_metadata.useDataSourceForPay) packed |= 1 << 82;
    // use redeem data source in bit 83.
    if (_metadata.useDataSourceForRedeem) packed |= 1 << 83;
    // data source address in bits 84-243.
    packed |= uint256(uint160(address(_metadata.dataSource))) << 84;
    // metadata in bits 244-252 (8 bits).
    packed |= _metadata.metadata << 244;
  }

  /**
    @notice
    Expand the funding cycle metadata.

    @param _fundingCycle The funding cycle having its metadata expanded.

    @return metadata The metadata object.
  */
  function expandMetadata(JBFundingCycle memory _fundingCycle)
    internal
    pure
    returns (JBFundingCycleMetadata memory)
  {
    return
      JBFundingCycleMetadata(
        global(_fundingCycle),
        reservedRate(_fundingCycle),
        redemptionRate(_fundingCycle),
        ballotRedemptionRate(_fundingCycle),
        payPaused(_fundingCycle),
        distributionsPaused(_fundingCycle),
        redeemPaused(_fundingCycle),
        burnPaused(_fundingCycle),
        mintingAllowed(_fundingCycle),
        terminalMigrationAllowed(_fundingCycle),
        controllerMigrationAllowed(_fundingCycle),
        shouldHoldFees(_fundingCycle),
        preferClaimedTokenOverride(_fundingCycle),
        useTotalOverflowForRedemptions(_fundingCycle),
        useDataSourceForPay(_fundingCycle),
        useDataSourceForRedeem(_fundingCycle),
        dataSource(_fundingCycle),
        metadata(_fundingCycle)
      );
  }
}

File 43 of 75 : JBGlobalFundingCycleMetadataResolver.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;

import './../structs/JBFundingCycleMetadata.sol';

library JBGlobalFundingCycleMetadataResolver {
  function setTerminalsAllowed(uint8 _data) internal pure returns (bool) {
    return (_data & 1) == 1;
  }

  function setControllerAllowed(uint8 _data) internal pure returns (bool) {
    return ((_data >> 1) & 1) == 1;
  }

  function transfersPaused(uint8 _data) internal pure returns (bool) {
    return ((_data >> 2) & 1) == 1;
  }

  /**
    @notice
    Pack the global funding cycle metadata.

    @param _metadata The metadata to validate and pack.

    @return packed The packed uint256 of all global metadata params. The first 8 bits specify the version.
  */
  function packFundingCycleGlobalMetadata(JBGlobalFundingCycleMetadata memory _metadata)
    internal
    pure
    returns (uint256 packed)
  {
    // allow set terminals in bit 0.
    if (_metadata.allowSetTerminals) packed |= 1;
    // allow set controller in bit 1.
    if (_metadata.allowSetController) packed |= 1 << 1;
    // pause transfers in bit 2.
    if (_metadata.pauseTransfers) packed |= 1 << 2;
  }

  /**
    @notice
    Expand the global funding cycle metadata.

    @param _packedMetadata The packed metadata to expand.

    @return metadata The global metadata object.
  */
  function expandMetadata(uint8 _packedMetadata)
    internal
    pure
    returns (JBGlobalFundingCycleMetadata memory metadata)
  {
    return
      JBGlobalFundingCycleMetadata(
        setTerminalsAllowed(_packedMetadata),
        setControllerAllowed(_packedMetadata),
        transfersPaused(_packedMetadata)
      );
  }
}

File 44 of 75 : JBOperations.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

library JBOperations {
  uint256 public constant RECONFIGURE = 1;
  uint256 public constant REDEEM = 2;
  uint256 public constant MIGRATE_CONTROLLER = 3;
  uint256 public constant MIGRATE_TERMINAL = 4;
  uint256 public constant PROCESS_FEES = 5;
  uint256 public constant SET_METADATA = 6;
  uint256 public constant ISSUE = 7;
  uint256 public constant SET_TOKEN = 8;
  uint256 public constant MINT = 9;
  uint256 public constant BURN = 10;
  uint256 public constant CLAIM = 11;
  uint256 public constant TRANSFER = 12;
  uint256 public constant REQUIRE_CLAIM = 13; // unused in v3
  uint256 public constant SET_CONTROLLER = 14;
  uint256 public constant SET_TERMINALS = 15;
  uint256 public constant SET_PRIMARY_TERMINAL = 16;
  uint256 public constant USE_ALLOWANCE = 17;
  uint256 public constant SET_SPLITS = 18;
}

File 45 of 75 : JBTokens.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

library JBTokens {
  /** 
    @notice 
    The ETH token address in Juicebox is represented by 0x000000000000000000000000000000000000EEEe.
  */
  address public constant ETH = address(0x000000000000000000000000000000000000EEEe);
}

File 46 of 75 : JBDidPayData.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import './JBTokenAmount.sol';

/** 
  @member payer The address from which the payment originated.
  @member projectId The ID of the project for which the payment was made.
  @member currentFundingCycleConfiguration The configuration of the funding cycle during which the payment is being made.
  @member amount The amount of the payment. Includes the token being paid, the value, the number of decimals included, and the currency of the amount.
  @member forwardedAmount The amount of the payment that is being sent to the delegate. Includes the token being paid, the value, the number of decimals included, and the currency of the amount.
  @member projectTokenCount The number of project tokens minted for the beneficiary.
  @member beneficiary The address to which the tokens were minted.
  @member preferClaimedTokens A flag indicating whether the request prefered to mint project tokens into the beneficiaries wallet rather than leaving them unclaimed. This is only possible if the project has an attached token contract.
  @member memo The memo that is being emitted alongside the payment.
  @member metadata Extra data to send to the delegate.
*/
struct JBDidPayData {
  address payer;
  uint256 projectId;
  uint256 currentFundingCycleConfiguration;
  JBTokenAmount amount;
  JBTokenAmount forwardedAmount;
  uint256 projectTokenCount;
  address beneficiary;
  bool preferClaimedTokens;
  string memo;
  bytes metadata;
}

File 47 of 75 : JBDidRedeemData.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import './JBTokenAmount.sol';

/** 
  @member holder The holder of the tokens being redeemed.
  @member projectId The ID of the project with which the redeemed tokens are associated.
  @member currentFundingCycleConfiguration The configuration of the funding cycle during which the redemption is being made.
  @member projectTokenCount The number of project tokens being redeemed.
  @member reclaimedAmount The amount reclaimed from the treasury. Includes the token being reclaimed, the value, the number of decimals included, and the currency of the amount.
  @member forwardedAmount The amount of the payment that is being sent to the delegate. Includes the token being paid, the value, the number of decimals included, and the currency of the amount.
  @member beneficiary The address to which the reclaimed amount will be sent.
  @member memo The memo that is being emitted alongside the redemption.
  @member metadata Extra data to send to the delegate.
*/
struct JBDidRedeemData {
  address holder;
  uint256 projectId;
  uint256 currentFundingCycleConfiguration;
  uint256 projectTokenCount;
  JBTokenAmount reclaimedAmount;
  JBTokenAmount forwardedAmount;
  address payable beneficiary;
  string memo;
  bytes metadata;
}

File 48 of 75 : JBFee.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/** 
  @member amount The total amount the fee was taken from, as a fixed point number with the same number of decimals as the terminal in which this struct was created.
  @member fee The percent of the fee, out of MAX_FEE.
  @member feeDiscount The discount of the fee.
  @member beneficiary The address that will receive the tokens that are minted as a result of the fee payment.
*/
struct JBFee {
  uint256 amount;
  uint32 fee;
  uint32 feeDiscount;
  address beneficiary;
}

File 49 of 75 : JBFundAccessConstraints.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import './../interfaces/IJBPaymentTerminal.sol';

/** 
  @member terminal The terminal within which the distribution limit and the overflow allowance applies.
  @member token The token for which the fund access constraints apply.
  @member distributionLimit The amount of the distribution limit, as a fixed point number with the same number of decimals as the terminal within which the limit applies.
  @member distributionLimitCurrency The currency of the distribution limit.
  @member overflowAllowance The amount of the allowance, as a fixed point number with the same number of decimals as the terminal within which the allowance applies.
  @member overflowAllowanceCurrency The currency of the overflow allowance.
*/
struct JBFundAccessConstraints {
  IJBPaymentTerminal terminal;
  address token;
  uint256 distributionLimit;
  uint256 distributionLimitCurrency;
  uint256 overflowAllowance;
  uint256 overflowAllowanceCurrency;
}

File 50 of 75 : JBFundingCycle.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import './../interfaces/IJBFundingCycleBallot.sol';

/** 
  @member number The funding cycle number for the cycle's project. Each funding cycle has a number that is an increment of the cycle that directly preceded it. Each project's first funding cycle has a number of 1.
  @member configuration The timestamp when the parameters for this funding cycle were configured. This value will stay the same for subsequent funding cycles that roll over from an originally configured cycle.
  @member basedOn The `configuration` of the funding cycle that was active when this cycle was created.
  @member start The timestamp marking the moment from which the funding cycle is considered active. It is a unix timestamp measured in seconds.
  @member duration The number of seconds the funding cycle lasts for, after which a new funding cycle will start. A duration of 0 means that the funding cycle will stay active until the project owner explicitly issues a reconfiguration, at which point a new funding cycle will immediately start with the updated properties. If the duration is greater than 0, a project owner cannot make changes to a funding cycle's parameters while it is active – any proposed changes will apply to the subsequent cycle. If no changes are proposed, a funding cycle rolls over to another one with the same properties but new `start` timestamp and a discounted `weight`.
  @member weight A fixed point number with 18 decimals that contracts can use to base arbitrary calculations on. For example, payment terminals can use this to determine how many tokens should be minted when a payment is received.
  @member discountRate A percent by how much the `weight` of the subsequent funding cycle should be reduced, if the project owner hasn't configured the subsequent funding cycle with an explicit `weight`. If it's 0, each funding cycle will have equal weight. If the number is 90%, the next funding cycle will have a 10% smaller weight. This weight is out of `JBConstants.MAX_DISCOUNT_RATE`.
  @member ballot An address of a contract that says whether a proposed reconfiguration should be accepted or rejected. It can be used to create rules around how a project owner can change funding cycle parameters over time.
  @member metadata Extra data that can be associated with a funding cycle.
*/
struct JBFundingCycle {
  uint256 number;
  uint256 configuration;
  uint256 basedOn;
  uint256 start;
  uint256 duration;
  uint256 weight;
  uint256 discountRate;
  IJBFundingCycleBallot ballot;
  uint256 metadata;
}

File 51 of 75 : JBFundingCycleData.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import './../interfaces/IJBFundingCycleBallot.sol';

/** 
  @member duration The number of seconds the funding cycle lasts for, after which a new funding cycle will start. A duration of 0 means that the funding cycle will stay active until the project owner explicitly issues a reconfiguration, at which point a new funding cycle will immediately start with the updated properties. If the duration is greater than 0, a project owner cannot make changes to a funding cycle's parameters while it is active – any proposed changes will apply to the subsequent cycle. If no changes are proposed, a funding cycle rolls over to another one with the same properties but new `start` timestamp and a discounted `weight`.
  @member weight A fixed point number with 18 decimals that contracts can use to base arbitrary calculations on. For example, payment terminals can use this to determine how many tokens should be minted when a payment is received.
  @member discountRate A percent by how much the `weight` of the subsequent funding cycle should be reduced, if the project owner hasn't configured the subsequent funding cycle with an explicit `weight`. If it's 0, each funding cycle will have equal weight. If the number is 90%, the next funding cycle will have a 10% smaller weight. This weight is out of `JBConstants.MAX_DISCOUNT_RATE`.
  @member ballot An address of a contract that says whether a proposed reconfiguration should be accepted or rejected. It can be used to create rules around how a project owner can change funding cycle parameters over time.
*/
struct JBFundingCycleData {
  uint256 duration;
  uint256 weight;
  uint256 discountRate;
  IJBFundingCycleBallot ballot;
}

File 52 of 75 : JBFundingCycleMetadata.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import './JBGlobalFundingCycleMetadata.sol';

/** 
  @member global Data used globally in non-migratable ecosystem contracts.
  @member reservedRate The reserved rate of the funding cycle. This number is a percentage calculated out of `JBConstants.MAX_RESERVED_RATE`.
  @member redemptionRate The redemption rate of the funding cycle. This number is a percentage calculated out of `JBConstants.MAX_REDEMPTION_RATE`.
  @member ballotRedemptionRate The redemption rate to use during an active ballot of the funding cycle. This number is a percentage calculated out of `JBConstants.MAX_REDEMPTION_RATE`.
  @member pausePay A flag indicating if the pay functionality should be paused during the funding cycle.
  @member pauseDistributions A flag indicating if the distribute functionality should be paused during the funding cycle.
  @member pauseRedeem A flag indicating if the redeem functionality should be paused during the funding cycle.
  @member pauseBurn A flag indicating if the burn functionality should be paused during the funding cycle.
  @member allowMinting A flag indicating if minting tokens should be allowed during this funding cycle.
  @member allowTerminalMigration A flag indicating if migrating terminals should be allowed during this funding cycle.
  @member allowControllerMigration A flag indicating if migrating controllers should be allowed during this funding cycle.
  @member holdFees A flag indicating if fees should be held during this funding cycle.
  @member preferClaimedTokenOverride A flag indicating if claimed tokens should always be prefered to unclaimed tokens when minting.
  @member useTotalOverflowForRedemptions A flag indicating if redemptions should use the project's balance held in all terminals instead of the project's local terminal balance from which the redemption is being fulfilled.
  @member useDataSourceForPay A flag indicating if the data source should be used for pay transactions during this funding cycle.
  @member useDataSourceForRedeem A flag indicating if the data source should be used for redeem transactions during this funding cycle.
  @member dataSource The data source to use during this funding cycle.
  @member metadata Metadata of the metadata, up to uint8 in size.
*/
struct JBFundingCycleMetadata {
  JBGlobalFundingCycleMetadata global;
  uint256 reservedRate;
  uint256 redemptionRate;
  uint256 ballotRedemptionRate;
  bool pausePay;
  bool pauseDistributions;
  bool pauseRedeem;
  bool pauseBurn;
  bool allowMinting;
  bool allowTerminalMigration;
  bool allowControllerMigration;
  bool holdFees;
  bool preferClaimedTokenOverride;
  bool useTotalOverflowForRedemptions;
  bool useDataSourceForPay;
  bool useDataSourceForRedeem;
  address dataSource;
  uint256 metadata;
}

File 53 of 75 : JBGlobalFundingCycleMetadata.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/** 
  @member allowSetTerminals A flag indicating if setting terminals should be allowed during this funding cycle.
  @member allowSetController A flag indicating if setting a new controller should be allowed during this funding cycle.
  @member pauseTransfers A flag indicating if the project token transfer functionality should be paused during the funding cycle.
*/
struct JBGlobalFundingCycleMetadata {
  bool allowSetTerminals;
  bool allowSetController;
  bool pauseTransfers;
}

File 54 of 75 : JBGroupedSplits.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import './JBSplit.sol';

/** 
  @member group The group indentifier.
  @member splits The splits to associate with the group.
*/
struct JBGroupedSplits {
  uint256 group;
  JBSplit[] splits;
}

File 55 of 75 : JBOperatorData.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/** 
  @member operator The address of the operator.
  @member domain The domain within which the operator is being given permissions. A domain of 0 is a wildcard domain, which gives an operator access to all domains.
  @member permissionIndexes The indexes of the permissions the operator is being given.
*/
struct JBOperatorData {
  address operator;
  uint256 domain;
  uint256[] permissionIndexes;
}

File 56 of 75 : JBPayDelegateAllocation.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import '../interfaces/IJBPayDelegate.sol';

/** 
 @member delegate A delegate contract to use for subsequent calls.
 @member amount The amount to send to the delegate.
*/
struct JBPayDelegateAllocation {
  IJBPayDelegate delegate;
  uint256 amount;
}

File 57 of 75 : JBProjectMetadata.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/** 
  @member content The metadata content.
  @member domain The domain within which the metadata applies.
*/
struct JBProjectMetadata {
  string content;
  uint256 domain;
}

File 58 of 75 : JBRedemptionDelegateAllocation.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import '../interfaces/IJBRedemptionDelegate.sol';

/** 
 @member delegate A delegate contract to use for subsequent calls.
 @member amount The amount to send to the delegate.
*/
struct JBRedemptionDelegateAllocation {
  IJBRedemptionDelegate delegate;
  uint256 amount;
}

File 59 of 75 : JBSplit.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import './../interfaces/IJBSplitAllocator.sol';

/** 
  @member preferClaimed A flag that only has effect if a projectId is also specified, and the project has a token contract attached. If so, this flag indicates if the tokens that result from making a payment to the project should be delivered claimed into the beneficiary's wallet, or unclaimed to save gas.
  @member preferAddToBalance A flag indicating if a distribution to a project should prefer triggering it's addToBalance function instead of its pay function.
  @member percent The percent of the whole group that this split occupies. This number is out of `JBConstants.SPLITS_TOTAL_PERCENT`.
  @member projectId The ID of a project. If an allocator is not set but a projectId is set, funds will be sent to the protocol treasury belonging to the project who's ID is specified. Resulting tokens will be routed to the beneficiary with the claimed token preference respected.
  @member beneficiary An address. The role the of the beneficary depends on whether or not projectId is specified, and whether or not an allocator is specified. If allocator is set, the beneficiary will be forwarded to the allocator for it to use. If allocator is not set but projectId is set, the beneficiary is the address to which the project's tokens will be sent that result from a payment to it. If neither allocator or projectId are set, the beneficiary is where the funds from the split will be sent.
  @member lockedUntil Specifies if the split should be unchangeable until the specified time, with the exception of extending the locked period.
  @member allocator If an allocator is specified, funds will be sent to the allocator contract along with all properties of this split.
*/
struct JBSplit {
  bool preferClaimed;
  bool preferAddToBalance;
  uint256 percent;
  uint256 projectId;
  address payable beneficiary;
  uint256 lockedUntil;
  IJBSplitAllocator allocator;
}

File 60 of 75 : JBSplitAllocationData.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import './JBSplit.sol';

/** 
  @member token The token being sent to the split allocator.
  @member amount The amount being sent to the split allocator, as a fixed point number.
  @member decimals The number of decimals in the amount.
  @member projectId The project to which the split belongs.
  @member group The group to which the split belongs.
  @member split The split that caused the allocation.
*/
struct JBSplitAllocationData {
  address token;
  uint256 amount;
  uint256 decimals;
  uint256 projectId;
  uint256 group;
  JBSplit split;
}

File 61 of 75 : JBTokenAmount.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/* 
  @member token The token the payment was made in.
  @member value The amount of tokens that was paid, as a fixed point number.
  @member decimals The number of decimals included in the value fixed point number.
  @member currency The expected currency of the value.
**/
struct JBTokenAmount {
  address token;
  uint256 value;
  uint256 decimals;
  uint256 currency;
}

File 62 of 75 : IJBProjectHandles.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;

import '@ensdomains/ens-contracts/contracts/resolvers/profiles/ITextResolver.sol';
import '@jbx-protocol/juice-contracts-v3/contracts/interfaces/IJBProjects.sol';

interface IJBProjectHandles {
  event SetEnsNameParts(
    uint256 indexed projectId,
    string indexed handle,
    string[] parts,
    address caller
  );

  function setEnsNamePartsFor(uint256 _projectId, string[] memory _parts) external;

  function ensNamePartsOf(uint256 _projectId) external view returns (string[] memory);

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

  function projects() external view returns (IJBProjects);

  function handleOf(uint256 _projectId) external view returns (string memory);
}

File 63 of 75 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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 Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        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 64 of 75 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

File 66 of 75 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @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] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

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

pragma solidity ^0.8.0;

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

File 69 of 75 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator,
        Rounding rounding
    ) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10**64) {
                value /= 10**64;
                result += 64;
            }
            if (value >= 10**32) {
                value /= 10**32;
                result += 32;
            }
            if (value >= 10**16) {
                value /= 10**16;
                result += 16;
            }
            if (value >= 10**8) {
                value /= 10**8;
                result += 8;
            }
            if (value >= 10**4) {
                value /= 10**4;
                result += 4;
            }
            if (value >= 10**2) {
                value /= 10**2;
                result += 2;
            }
            if (value >= 10**1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
        }
    }
}

File 70 of 75 : PRBMath.sol
// SPDX-License-Identifier: Unlicense
pragma solidity >=0.8.4;

import "prb-math/contracts/PRBMath.sol";

File 71 of 75 : 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;
    }
}

File 72 of 75 : PRBMath.sol
// SPDX-License-Identifier: Unlicense
pragma solidity >=0.8.4;

/// @notice Emitted when the result overflows uint256.
error PRBMath__MulDivFixedPointOverflow(uint256 prod1);

/// @notice Emitted when the result overflows uint256.
error PRBMath__MulDivOverflow(uint256 prod1, uint256 denominator);

/// @notice Emitted when one of the inputs is type(int256).min.
error PRBMath__MulDivSignedInputTooSmall();

/// @notice Emitted when the intermediary absolute result overflows int256.
error PRBMath__MulDivSignedOverflow(uint256 rAbs);

/// @notice Emitted when the input is MIN_SD59x18.
error PRBMathSD59x18__AbsInputTooSmall();

/// @notice Emitted when ceiling a number overflows SD59x18.
error PRBMathSD59x18__CeilOverflow(int256 x);

/// @notice Emitted when one of the inputs is MIN_SD59x18.
error PRBMathSD59x18__DivInputTooSmall();

/// @notice Emitted when one of the intermediary unsigned results overflows SD59x18.
error PRBMathSD59x18__DivOverflow(uint256 rAbs);

/// @notice Emitted when the input is greater than 133.084258667509499441.
error PRBMathSD59x18__ExpInputTooBig(int256 x);

/// @notice Emitted when the input is greater than 192.
error PRBMathSD59x18__Exp2InputTooBig(int256 x);

/// @notice Emitted when flooring a number underflows SD59x18.
error PRBMathSD59x18__FloorUnderflow(int256 x);

/// @notice Emitted when converting a basic integer to the fixed-point format overflows SD59x18.
error PRBMathSD59x18__FromIntOverflow(int256 x);

/// @notice Emitted when converting a basic integer to the fixed-point format underflows SD59x18.
error PRBMathSD59x18__FromIntUnderflow(int256 x);

/// @notice Emitted when the product of the inputs is negative.
error PRBMathSD59x18__GmNegativeProduct(int256 x, int256 y);

/// @notice Emitted when multiplying the inputs overflows SD59x18.
error PRBMathSD59x18__GmOverflow(int256 x, int256 y);

/// @notice Emitted when the input is less than or equal to zero.
error PRBMathSD59x18__LogInputTooSmall(int256 x);

/// @notice Emitted when one of the inputs is MIN_SD59x18.
error PRBMathSD59x18__MulInputTooSmall();

/// @notice Emitted when the intermediary absolute result overflows SD59x18.
error PRBMathSD59x18__MulOverflow(uint256 rAbs);

/// @notice Emitted when the intermediary absolute result overflows SD59x18.
error PRBMathSD59x18__PowuOverflow(uint256 rAbs);

/// @notice Emitted when the input is negative.
error PRBMathSD59x18__SqrtNegativeInput(int256 x);

/// @notice Emitted when the calculating the square root overflows SD59x18.
error PRBMathSD59x18__SqrtOverflow(int256 x);

/// @notice Emitted when addition overflows UD60x18.
error PRBMathUD60x18__AddOverflow(uint256 x, uint256 y);

/// @notice Emitted when ceiling a number overflows UD60x18.
error PRBMathUD60x18__CeilOverflow(uint256 x);

/// @notice Emitted when the input is greater than 133.084258667509499441.
error PRBMathUD60x18__ExpInputTooBig(uint256 x);

/// @notice Emitted when the input is greater than 192.
error PRBMathUD60x18__Exp2InputTooBig(uint256 x);

/// @notice Emitted when converting a basic integer to the fixed-point format format overflows UD60x18.
error PRBMathUD60x18__FromUintOverflow(uint256 x);

/// @notice Emitted when multiplying the inputs overflows UD60x18.
error PRBMathUD60x18__GmOverflow(uint256 x, uint256 y);

/// @notice Emitted when the input is less than 1.
error PRBMathUD60x18__LogInputTooSmall(uint256 x);

/// @notice Emitted when the calculating the square root overflows UD60x18.
error PRBMathUD60x18__SqrtOverflow(uint256 x);

/// @notice Emitted when subtraction underflows UD60x18.
error PRBMathUD60x18__SubUnderflow(uint256 x, uint256 y);

/// @dev Common mathematical functions used in both PRBMathSD59x18 and PRBMathUD60x18. Note that this shared library
/// does not always assume the signed 59.18-decimal fixed-point or the unsigned 60.18-decimal fixed-point
/// representation. When it does not, it is explicitly mentioned in the NatSpec documentation.
library PRBMath {
    /// STRUCTS ///

    struct SD59x18 {
        int256 value;
    }

    struct UD60x18 {
        uint256 value;
    }

    /// STORAGE ///

    /// @dev How many trailing decimals can be represented.
    uint256 internal constant SCALE = 1e18;

    /// @dev Largest power of two divisor of SCALE.
    uint256 internal constant SCALE_LPOTD = 262144;

    /// @dev SCALE inverted mod 2^256.
    uint256 internal constant SCALE_INVERSE =
        78156646155174841979727994598816262306175212592076161876661_508869554232690281;

    /// FUNCTIONS ///

    /// @notice Calculates the binary exponent of x using the binary fraction method.
    /// @dev Has to use 192.64-bit fixed-point numbers.
    /// See https://ethereum.stackexchange.com/a/96594/24693.
    /// @param x The exponent as an unsigned 192.64-bit fixed-point number.
    /// @return result The result as an unsigned 60.18-decimal fixed-point number.
    function exp2(uint256 x) internal pure returns (uint256 result) {
        unchecked {
            // Start from 0.5 in the 192.64-bit fixed-point format.
            result = 0x800000000000000000000000000000000000000000000000;

            // Multiply the result by root(2, 2^-i) when the bit at position i is 1. None of the intermediary results overflows
            // because the initial result is 2^191 and all magic factors are less than 2^65.
            if (x & 0x8000000000000000 > 0) {
                result = (result * 0x16A09E667F3BCC909) >> 64;
            }
            if (x & 0x4000000000000000 > 0) {
                result = (result * 0x1306FE0A31B7152DF) >> 64;
            }
            if (x & 0x2000000000000000 > 0) {
                result = (result * 0x1172B83C7D517ADCE) >> 64;
            }
            if (x & 0x1000000000000000 > 0) {
                result = (result * 0x10B5586CF9890F62A) >> 64;
            }
            if (x & 0x800000000000000 > 0) {
                result = (result * 0x1059B0D31585743AE) >> 64;
            }
            if (x & 0x400000000000000 > 0) {
                result = (result * 0x102C9A3E778060EE7) >> 64;
            }
            if (x & 0x200000000000000 > 0) {
                result = (result * 0x10163DA9FB33356D8) >> 64;
            }
            if (x & 0x100000000000000 > 0) {
                result = (result * 0x100B1AFA5ABCBED61) >> 64;
            }
            if (x & 0x80000000000000 > 0) {
                result = (result * 0x10058C86DA1C09EA2) >> 64;
            }
            if (x & 0x40000000000000 > 0) {
                result = (result * 0x1002C605E2E8CEC50) >> 64;
            }
            if (x & 0x20000000000000 > 0) {
                result = (result * 0x100162F3904051FA1) >> 64;
            }
            if (x & 0x10000000000000 > 0) {
                result = (result * 0x1000B175EFFDC76BA) >> 64;
            }
            if (x & 0x8000000000000 > 0) {
                result = (result * 0x100058BA01FB9F96D) >> 64;
            }
            if (x & 0x4000000000000 > 0) {
                result = (result * 0x10002C5CC37DA9492) >> 64;
            }
            if (x & 0x2000000000000 > 0) {
                result = (result * 0x1000162E525EE0547) >> 64;
            }
            if (x & 0x1000000000000 > 0) {
                result = (result * 0x10000B17255775C04) >> 64;
            }
            if (x & 0x800000000000 > 0) {
                result = (result * 0x1000058B91B5BC9AE) >> 64;
            }
            if (x & 0x400000000000 > 0) {
                result = (result * 0x100002C5C89D5EC6D) >> 64;
            }
            if (x & 0x200000000000 > 0) {
                result = (result * 0x10000162E43F4F831) >> 64;
            }
            if (x & 0x100000000000 > 0) {
                result = (result * 0x100000B1721BCFC9A) >> 64;
            }
            if (x & 0x80000000000 > 0) {
                result = (result * 0x10000058B90CF1E6E) >> 64;
            }
            if (x & 0x40000000000 > 0) {
                result = (result * 0x1000002C5C863B73F) >> 64;
            }
            if (x & 0x20000000000 > 0) {
                result = (result * 0x100000162E430E5A2) >> 64;
            }
            if (x & 0x10000000000 > 0) {
                result = (result * 0x1000000B172183551) >> 64;
            }
            if (x & 0x8000000000 > 0) {
                result = (result * 0x100000058B90C0B49) >> 64;
            }
            if (x & 0x4000000000 > 0) {
                result = (result * 0x10000002C5C8601CC) >> 64;
            }
            if (x & 0x2000000000 > 0) {
                result = (result * 0x1000000162E42FFF0) >> 64;
            }
            if (x & 0x1000000000 > 0) {
                result = (result * 0x10000000B17217FBB) >> 64;
            }
            if (x & 0x800000000 > 0) {
                result = (result * 0x1000000058B90BFCE) >> 64;
            }
            if (x & 0x400000000 > 0) {
                result = (result * 0x100000002C5C85FE3) >> 64;
            }
            if (x & 0x200000000 > 0) {
                result = (result * 0x10000000162E42FF1) >> 64;
            }
            if (x & 0x100000000 > 0) {
                result = (result * 0x100000000B17217F8) >> 64;
            }
            if (x & 0x80000000 > 0) {
                result = (result * 0x10000000058B90BFC) >> 64;
            }
            if (x & 0x40000000 > 0) {
                result = (result * 0x1000000002C5C85FE) >> 64;
            }
            if (x & 0x20000000 > 0) {
                result = (result * 0x100000000162E42FF) >> 64;
            }
            if (x & 0x10000000 > 0) {
                result = (result * 0x1000000000B17217F) >> 64;
            }
            if (x & 0x8000000 > 0) {
                result = (result * 0x100000000058B90C0) >> 64;
            }
            if (x & 0x4000000 > 0) {
                result = (result * 0x10000000002C5C860) >> 64;
            }
            if (x & 0x2000000 > 0) {
                result = (result * 0x1000000000162E430) >> 64;
            }
            if (x & 0x1000000 > 0) {
                result = (result * 0x10000000000B17218) >> 64;
            }
            if (x & 0x800000 > 0) {
                result = (result * 0x1000000000058B90C) >> 64;
            }
            if (x & 0x400000 > 0) {
                result = (result * 0x100000000002C5C86) >> 64;
            }
            if (x & 0x200000 > 0) {
                result = (result * 0x10000000000162E43) >> 64;
            }
            if (x & 0x100000 > 0) {
                result = (result * 0x100000000000B1721) >> 64;
            }
            if (x & 0x80000 > 0) {
                result = (result * 0x10000000000058B91) >> 64;
            }
            if (x & 0x40000 > 0) {
                result = (result * 0x1000000000002C5C8) >> 64;
            }
            if (x & 0x20000 > 0) {
                result = (result * 0x100000000000162E4) >> 64;
            }
            if (x & 0x10000 > 0) {
                result = (result * 0x1000000000000B172) >> 64;
            }
            if (x & 0x8000 > 0) {
                result = (result * 0x100000000000058B9) >> 64;
            }
            if (x & 0x4000 > 0) {
                result = (result * 0x10000000000002C5D) >> 64;
            }
            if (x & 0x2000 > 0) {
                result = (result * 0x1000000000000162E) >> 64;
            }
            if (x & 0x1000 > 0) {
                result = (result * 0x10000000000000B17) >> 64;
            }
            if (x & 0x800 > 0) {
                result = (result * 0x1000000000000058C) >> 64;
            }
            if (x & 0x400 > 0) {
                result = (result * 0x100000000000002C6) >> 64;
            }
            if (x & 0x200 > 0) {
                result = (result * 0x10000000000000163) >> 64;
            }
            if (x & 0x100 > 0) {
                result = (result * 0x100000000000000B1) >> 64;
            }
            if (x & 0x80 > 0) {
                result = (result * 0x10000000000000059) >> 64;
            }
            if (x & 0x40 > 0) {
                result = (result * 0x1000000000000002C) >> 64;
            }
            if (x & 0x20 > 0) {
                result = (result * 0x10000000000000016) >> 64;
            }
            if (x & 0x10 > 0) {
                result = (result * 0x1000000000000000B) >> 64;
            }
            if (x & 0x8 > 0) {
                result = (result * 0x10000000000000006) >> 64;
            }
            if (x & 0x4 > 0) {
                result = (result * 0x10000000000000003) >> 64;
            }
            if (x & 0x2 > 0) {
                result = (result * 0x10000000000000001) >> 64;
            }
            if (x & 0x1 > 0) {
                result = (result * 0x10000000000000001) >> 64;
            }

            // We're doing two things at the same time:
            //
            //   1. Multiply the result by 2^n + 1, where "2^n" is the integer part and the one is added to account for
            //      the fact that we initially set the result to 0.5. This is accomplished by subtracting from 191
            //      rather than 192.
            //   2. Convert the result to the unsigned 60.18-decimal fixed-point format.
            //
            // This works because 2^(191-ip) = 2^ip / 2^191, where "ip" is the integer part "2^n".
            result *= SCALE;
            result >>= (191 - (x >> 64));
        }
    }

    /// @notice Finds the zero-based index of the first one in the binary representation of x.
    /// @dev See the note on msb in the "Find First Set" Wikipedia article https://en.wikipedia.org/wiki/Find_first_set
    /// @param x The uint256 number for which to find the index of the most significant bit.
    /// @return msb The index of the most significant bit as an uint256.
    function mostSignificantBit(uint256 x) internal pure returns (uint256 msb) {
        if (x >= 2**128) {
            x >>= 128;
            msb += 128;
        }
        if (x >= 2**64) {
            x >>= 64;
            msb += 64;
        }
        if (x >= 2**32) {
            x >>= 32;
            msb += 32;
        }
        if (x >= 2**16) {
            x >>= 16;
            msb += 16;
        }
        if (x >= 2**8) {
            x >>= 8;
            msb += 8;
        }
        if (x >= 2**4) {
            x >>= 4;
            msb += 4;
        }
        if (x >= 2**2) {
            x >>= 2;
            msb += 2;
        }
        if (x >= 2**1) {
            // No need to shift x any more.
            msb += 1;
        }
    }

    /// @notice Calculates floor(x*y÷denominator) with full precision.
    ///
    /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv.
    ///
    /// Requirements:
    /// - The denominator cannot be zero.
    /// - The result must fit within uint256.
    ///
    /// Caveats:
    /// - This function does not work with fixed-point numbers.
    ///
    /// @param x The multiplicand as an uint256.
    /// @param y The multiplier as an uint256.
    /// @param denominator The divisor as an uint256.
    /// @return result The result as an uint256.
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
        // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
        // variables such that product = prod1 * 2^256 + prod0.
        uint256 prod0; // Least significant 256 bits of the product
        uint256 prod1; // Most significant 256 bits of the product
        assembly {
            let mm := mulmod(x, y, not(0))
            prod0 := mul(x, y)
            prod1 := sub(sub(mm, prod0), lt(mm, prod0))
        }

        // Handle non-overflow cases, 256 by 256 division.
        if (prod1 == 0) {
            unchecked {
                result = prod0 / denominator;
            }
            return result;
        }

        // Make sure the result is less than 2^256. Also prevents denominator == 0.
        if (prod1 >= denominator) {
            revert PRBMath__MulDivOverflow(prod1, denominator);
        }

        ///////////////////////////////////////////////
        // 512 by 256 division.
        ///////////////////////////////////////////////

        // Make division exact by subtracting the remainder from [prod1 prod0].
        uint256 remainder;
        assembly {
            // Compute remainder using mulmod.
            remainder := mulmod(x, y, denominator)

            // Subtract 256 bit number from 512 bit number.
            prod1 := sub(prod1, gt(remainder, prod0))
            prod0 := sub(prod0, remainder)
        }

        // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
        // See https://cs.stackexchange.com/q/138556/92363.
        unchecked {
            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 lpotdod = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by lpotdod.
                denominator := div(denominator, lpotdod)

                // Divide [prod1 prod0] by lpotdod.
                prod0 := div(prod0, lpotdod)

                // Flip lpotdod such that it is 2^256 / lpotdod. If lpotdod is zero, then it becomes one.
                lpotdod := add(div(sub(0, lpotdod), lpotdod), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * lpotdod;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /// @notice Calculates floor(x*y÷1e18) with full precision.
    ///
    /// @dev Variant of "mulDiv" with constant folding, i.e. in which the denominator is always 1e18. Before returning the
    /// final result, we add 1 if (x * y) % SCALE >= HALF_SCALE. Without this, 6.6e-19 would be truncated to 0 instead of
    /// being rounded to 1e-18.  See "Listing 6" and text above it at https://accu.org/index.php/journals/1717.
    ///
    /// Requirements:
    /// - The result must fit within uint256.
    ///
    /// Caveats:
    /// - The body is purposely left uncommented; see the NatSpec comments in "PRBMath.mulDiv" to understand how this works.
    /// - It is assumed that the result can never be type(uint256).max when x and y solve the following two equations:
    ///     1. x * y = type(uint256).max * SCALE
    ///     2. (x * y) % SCALE >= SCALE / 2
    ///
    /// @param x The multiplicand as an unsigned 60.18-decimal fixed-point number.
    /// @param y The multiplier as an unsigned 60.18-decimal fixed-point number.
    /// @return result The result as an unsigned 60.18-decimal fixed-point number.
    function mulDivFixedPoint(uint256 x, uint256 y) internal pure returns (uint256 result) {
        uint256 prod0;
        uint256 prod1;
        assembly {
            let mm := mulmod(x, y, not(0))
            prod0 := mul(x, y)
            prod1 := sub(sub(mm, prod0), lt(mm, prod0))
        }

        if (prod1 >= SCALE) {
            revert PRBMath__MulDivFixedPointOverflow(prod1);
        }

        uint256 remainder;
        uint256 roundUpUnit;
        assembly {
            remainder := mulmod(x, y, SCALE)
            roundUpUnit := gt(remainder, 499999999999999999)
        }

        if (prod1 == 0) {
            unchecked {
                result = (prod0 / SCALE) + roundUpUnit;
                return result;
            }
        }

        assembly {
            result := add(
                mul(
                    or(
                        div(sub(prod0, remainder), SCALE_LPOTD),
                        mul(sub(prod1, gt(remainder, prod0)), add(div(sub(0, SCALE_LPOTD), SCALE_LPOTD), 1))
                    ),
                    SCALE_INVERSE
                ),
                roundUpUnit
            )
        }
    }

    /// @notice Calculates floor(x*y÷denominator) with full precision.
    ///
    /// @dev An extension of "mulDiv" for signed numbers. Works by computing the signs and the absolute values separately.
    ///
    /// Requirements:
    /// - None of the inputs can be type(int256).min.
    /// - The result must fit within int256.
    ///
    /// @param x The multiplicand as an int256.
    /// @param y The multiplier as an int256.
    /// @param denominator The divisor as an int256.
    /// @return result The result as an int256.
    function mulDivSigned(
        int256 x,
        int256 y,
        int256 denominator
    ) internal pure returns (int256 result) {
        if (x == type(int256).min || y == type(int256).min || denominator == type(int256).min) {
            revert PRBMath__MulDivSignedInputTooSmall();
        }

        // Get hold of the absolute values of x, y and the denominator.
        uint256 ax;
        uint256 ay;
        uint256 ad;
        unchecked {
            ax = x < 0 ? uint256(-x) : uint256(x);
            ay = y < 0 ? uint256(-y) : uint256(y);
            ad = denominator < 0 ? uint256(-denominator) : uint256(denominator);
        }

        // Compute the absolute value of (x*y)÷denominator. The result must fit within int256.
        uint256 rAbs = mulDiv(ax, ay, ad);
        if (rAbs > uint256(type(int256).max)) {
            revert PRBMath__MulDivSignedOverflow(rAbs);
        }

        // Get the signs of x, y and the denominator.
        uint256 sx;
        uint256 sy;
        uint256 sd;
        assembly {
            sx := sgt(x, sub(0, 1))
            sy := sgt(y, sub(0, 1))
            sd := sgt(denominator, sub(0, 1))
        }

        // XOR over sx, sy and sd. This is checking whether there are one or three negative signs in the inputs.
        // If yes, the result should be negative.
        result = sx ^ sy ^ sd == 0 ? -int256(rAbs) : int256(rAbs);
    }

    /// @notice Calculates the square root of x, rounding down.
    /// @dev Uses the Babylonian method https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method.
    ///
    /// Caveats:
    /// - This function does not work with fixed-point numbers.
    ///
    /// @param x The uint256 number for which to calculate the square root.
    /// @return result The result as an uint256.
    function sqrt(uint256 x) internal pure returns (uint256 result) {
        if (x == 0) {
            return 0;
        }

        // Set the initial guess to the least power of two that is greater than or equal to sqrt(x).
        uint256 xAux = uint256(x);
        result = 1;
        if (xAux >= 0x100000000000000000000000000000000) {
            xAux >>= 128;
            result <<= 64;
        }
        if (xAux >= 0x10000000000000000) {
            xAux >>= 64;
            result <<= 32;
        }
        if (xAux >= 0x100000000) {
            xAux >>= 32;
            result <<= 16;
        }
        if (xAux >= 0x10000) {
            xAux >>= 16;
            result <<= 8;
        }
        if (xAux >= 0x100) {
            xAux >>= 8;
            result <<= 4;
        }
        if (xAux >= 0x10) {
            xAux >>= 4;
            result <<= 2;
        }
        if (xAux >= 0x8) {
            result <<= 1;
        }

        // The operations can never overflow because the result is max 2^127 when it enters this block.
        unchecked {
            result = (result + x / result) >> 1;
            result = (result + x / result) >> 1;
            result = (result + x / result) >> 1;
            result = (result + x / result) >> 1;
            result = (result + x / result) >> 1;
            result = (result + x / result) >> 1;
            result = (result + x / result) >> 1; // Seven iterations should be enough
            uint256 roundedDownResult = x / result;
            return result >= roundedDownResult ? roundedDownResult : result;
        }
    }
}

File 74 of 75 : JBUriOperations.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

library JBUriOperations {
  uint256 public constant SET_TOKEN_URI = 20;
}

File 75 of 75 : StringSlicer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

library StringSlicer {
    /// @notice Abbreviates a string.
    /// @dev This function uses Array Slices (https://blog.soliditylang.org/2020/05/26/array-slices/), which only work on calldata. The function must therefore live in a separate contract for a Token Resolver to use Array Slices.
    /// @param _str The string to mutate.
    /// @param _start The first index of the input string to include in the output.
    /// @param _end The last index of the input string to include in the output.
    /// @return string The abbreviated string.
    function slice(
        string calldata _str,
        uint256 _start,
        uint256 _end
    ) external pure returns (string memory) {
        return string(bytes(_str)[_start:_end]);
    }
}

File 76 of 75 : Theme.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {Color} from "solcolor/src/Types.sol";

/**
 * @notice Themes contain color data for styling SVGs.
 * @member customTheme True for all Themes except the default theme.
 * @member textColor The color of the text.
 * @member bgColor The primary background color.
 * @member bgColorAlt The secondary background color.
 */
struct Theme {
    bool customTheme;
    Color textColor;
    Color bgColor;
    Color bgColorAlt;
}

Settings
{
  "remappings": [
    "@ensdomains/=node_modules/@ensdomains/",
    "@jbx-protocol/=node_modules/@jbx-protocol/",
    "@openzeppelin/=node_modules/@openzeppelin/",
    "@paulrberg/=node_modules/@paulrberg/",
    "base64-sol/=node_modules/base64-sol/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "prb-math/=node_modules/prb-math/",
    "solcolor/=lib/solcolor/",
    "typeface/=lib/typeface/contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "london",
  "libraries": {
    "src/Libraries/StringSlicer.sol": {
      "StringSlicer": "0xb57439a1e9cde287c63cc791478bef6bdb40edbf"
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IJBOperatorStore","name":"_operatorStore","type":"address"},{"internalType":"contract IJBDirectory","name":"_directory","type":"address"},{"internalType":"contract IJBController","name":"_controller","type":"address"},{"internalType":"contract IJBController3_1","name":"_controller3_1","type":"address"},{"internalType":"contract IJBProjectHandles","name":"_projectHandles","type":"address"},{"internalType":"contract ITypeface","name":"_capsulesTypeface","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"bytes1","name":"_character","type":"bytes1"}],"name":"INVALID_HEX_CHARACTER","type":"error"},{"inputs":[],"name":"INVALID_HEX_STRING","type":"error"},{"inputs":[],"name":"UNAUTHORIZED","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"projectId","type":"uint256"}],"name":"ThemeReset","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"projectId","type":"uint256"},{"indexed":false,"internalType":"Color","name":"textColor","type":"bytes3"},{"indexed":false,"internalType":"Color","name":"bgColor","type":"bytes3"},{"indexed":false,"internalType":"Color","name":"bgColorAlt","type":"bytes3"}],"name":"ThemeSet","type":"event"},{"inputs":[],"name":"capsulesTypeface","outputs":[{"internalType":"contract ITypeface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"controller","outputs":[{"internalType":"contract IJBController","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"controller3_1","outputs":[{"internalType":"contract IJBController3_1","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"directory","outputs":[{"internalType":"contract IJBDirectory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"fundingCycleStore","outputs":[{"internalType":"contract IJBFundingCycleStore","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getTheme","outputs":[{"components":[{"internalType":"bool","name":"customTheme","type":"bool"},{"internalType":"Color","name":"textColor","type":"bytes3"},{"internalType":"Color","name":"bgColor","type":"bytes3"},{"internalType":"Color","name":"bgColorAlt","type":"bytes3"}],"internalType":"struct Theme","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_projectId","type":"uint256"}],"name":"getUri","outputs":[{"internalType":"string","name":"tokenUri","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"operatorStore","outputs":[{"internalType":"contract IJBOperatorStore","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"projectHandles","outputs":[{"internalType":"contract IJBProjectHandles","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"projects","outputs":[{"internalType":"contract IJBProjects","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_projectId","type":"uint256"}],"name":"resetTheme","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_textColor","type":"string"},{"internalType":"string","name":"_bgColor","type":"string"},{"internalType":"string","name":"_bgColorAlt","type":"string"}],"name":"setDefaultTheme","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_projectId","type":"uint256"},{"internalType":"string","name":"_textColor","type":"string"},{"internalType":"string","name":"_bgColor","type":"string"},{"internalType":"string","name":"_bgColorAlt","type":"string"}],"name":"setTheme","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

6101806040523480156200001257600080fd5b5060405162005700380380620057008339810160408190526200003591620006ce565b6001600160a01b0386166080526200004d33620001c7565b6001600160a01b03851660e0819052604080516322de550f60e21b81529051638b79543c916004808201926020929091908290030181865afa15801562000098573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000be919062000762565b6001600160a01b0390811660c052848116610140528381166101605260e0516040805163557e715560e01b81529051919092169163557e71559160048083019260209291908290030181865afa1580156200011d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000143919062000762565b6001600160a01b0390811660a0528281166101005281166101205260408051808201825260068082526546463932313360d01b60208084019190915283518085018552828152651a1a189c982360d11b8183015284518086019095529184526533413046304360d01b90840152620001bb9262000217565b505050505050620007cd565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6200022162000366565b60006200022e84620003c8565b905060006200023d84620003c8565b905060006200024c84620003c8565b604080516080808201835260018083526001600160e81b031988811660208086018281528a8416878901818152948a166060808a01828152600080805298865299517fa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb498054955198519b5163ffffffff1990961691151563ffffff0019169190911761010060e8998a1c021765ffffffffffff60201b19166401000000009b891c9b909b0262ffffff60381b19169a909a176701000000000000009490971c939093029590951790975587519485529084019190915294820193909352928301919091529192507fe0d41df1edcb26e1d1d7443cfe84d155389c0d9601d223399b7fb7f954313787910160405180910390a1505050505050565b6000546001600160a01b03163314620003c65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b565b8051600090829082620003de6006600162000789565b60ff16821480620003fe5750620003f86003600162000789565b60ff1682145b80156200043357508251602360f81b908490600090620004225762000422620007b7565b01602001516001600160f81b031916145b156200044157506000190160015b600519820162000563576000808260050190506200047b8582815181106200046d576200046d620007b7565b016020015160f81c6200062c565b60e81b821791506004620004a4868360019003935083815181106200046d576200046d620007b7565b901b60e81b821791506008620004cf868360019003935083815181106200046d576200046d620007b7565b901b60e81b82179150600c620004fa868360019003935083815181106200046d576200046d620007b7565b901b60e81b82179150601062000525868360019003935083815181106200046d576200046d620007b7565b901b60e81b82179150601462000550868360019003935083815181106200046d576200046d620007b7565b901b60e81b919091179695505050505050565b600219820162000613576000808260020190506000620005918683815181106200046d576200046d620007b7565b9050600481901b811760e81b83179250620005c1868360019003935083815181106200046d576200046d620007b7565b9050600c81901b600882901b1760e81b83179250620005f5868360019003935083815181106200046d576200046d620007b7565b601081901b60149190911b1760e81b92909217979650505050505050565b6040516393d3193d60e01b815260040160405180910390fd5b600060308260ff161015801562000647575060398260ff1611155b156200065957603082039150620006ae565b60418260ff161015801562000672575060468260ff1611155b156200068457603782039150620006ae565b6040516303bc56bd60e21b81526001600160f81b031960f884901b166004820152602401620003bd565b5060ff1690565b6001600160a01b0381168114620006cb57600080fd5b50565b60008060008060008060c08789031215620006e857600080fd5b8651620006f581620006b5565b60208801519096506200070881620006b5565b60408801519095506200071b81620006b5565b60608801519094506200072e81620006b5565b60808801519093506200074181620006b5565b60a08801519092506200075481620006b5565b809150509295509295509295565b6000602082840312156200077557600080fd5b81516200078281620006b5565b9392505050565b60ff8181168382160190811115620007b157634e487b7160e01b600052601160045260246000fd5b92915050565b634e487b7160e01b600052603260045260246000fd5b60805160a05160c05160e05161010051610120516101405161016051614e17620008e9600039600081816101750152818161150c01528181611547015281816122570152818161283f015261287a0152600081816103960152818161164701528181611695015281816121af0152818161297a01526129c801526000818161035c01526123700152600081816102b40152818161108e015261113e0152600081816103150152818161087d0152818161149a015281816120490152818161214001526127ab01526000818161027c015281816103ce01528181610620015261098c0152600081816101310152818161140b01528181611b4c01526127380152600081816102db01528181610c220152610cc90152614e176000f3fe608060405234801561001057600080fd5b50600436106100ff5760003560e01c80639f3621dd11610097578063da0544aa11610066578063da0544aa14610337578063dfee225f14610357578063f2fde38b1461037e578063f77c47911461039157600080fd5b80639f3621dd146102af578063ad007d63146102d6578063be392d7e146102fd578063c41c2f241461031057600080fd5b8063715018a6116100d3578063715018a6146101975780637fc5e91d1461019f5780638b79543c146102775780638da5cb5b1461029e57600080fd5b8062073c191461010457806303b8747114610119578063557e71551461012c5780636ced113414610170575b600080fd5b6101176101123660046132e9565b6103b8565b005b6101176101273660046133f1565b6104ae565b6101537f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020015b60405180910390f35b6101537f000000000000000000000000000000000000000000000000000000000000000081565b6101176105f6565b6102306101ad3660046132e9565b604080516080808201835260008083526020808401829052838501829052606093840182905294815260018552839020835191820184525460ff8116151582526001600160e81b0319610100820460e890811b8216968401969096526401000000008204861b811694830194909452600160381b900490931b9091169082015290565b60405161016791908151151581526020808301516001600160e81b031990811691830191909152604080840151821690830152606092830151169181019190915260800190565b6101537f000000000000000000000000000000000000000000000000000000000000000081565b6000546001600160a01b0316610153565b6101537f000000000000000000000000000000000000000000000000000000000000000081565b6101537f000000000000000000000000000000000000000000000000000000000000000081565b61011761030b366004613479565b61060a565b6101537f000000000000000000000000000000000000000000000000000000000000000081565b61034a6103453660046132e9565b610815565b604051610167919061355b565b6101537f000000000000000000000000000000000000000000000000000000000000000081565b61011761038c366004613583565b610b5d565b6101537f000000000000000000000000000000000000000000000000000000000000000081565b6040516331a9108f60e11b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa15801561041d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061044191906135a0565b81601461044f838383610bdb565b60008481526001602052604090819020805469ffffffffffffffffffff19169055517fba355f24c186f336fa45b38770b5ae76456ec3ce2f2818115a89890a98b7e535906104a09086815260200190565b60405180910390a150505050565b6104b6610d59565b60006104c184610db3565b905060006104ce84610db3565b905060006104db84610db3565b604080516080808201835260018083526001600160e81b031988811660208086018281528a8416878901818152948a166060808a01828152600080805298865299517fa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb498054955198519b5163ffffffff1990961691151563ffffff0019169190911761010060e8998a1c021769ffffffffffff0000000019166401000000009b891c9b909b0269ffffff0000000000000019169a909a17600160381b9490971c939093029590951790975587519485529084019190915294820193909352928301919091529192507fe0d41df1edcb26e1d1d7443cfe84d155389c0d9601d223399b7fb7f954313787910160405180910390a1505050505050565b6105fe610d59565b6106086000610fe6565b565b6040516331a9108f60e11b8152600481018590527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690636352211e90602401602060405180830381865afa15801561066f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061069391906135a0565b8460146106a1838383610bdb565b60006106ac87610db3565b905060006106b987610db3565b905060006106c687610db3565b90506040518060800160405280600115158152602001846001600160e81b0319168152602001836001600160e81b0319168152602001826001600160e81b031916815250600160008c815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a81548162ffffff021916908360e81c021790555060408201518160000160046101000a81548162ffffff021916908360e81c021790555060608201518160000160076101000a81548162ffffff021916908360e81c02179055509050507fe0d41df1edcb26e1d1d7443cfe84d155389c0d9601d223399b7fb7f9543137878a84848460405161080194939291909384526001600160e81b03199283166020850152908216604084015216606082015260800190565b60405180910390a150505050505050505050565b604080516002808252606082810190935260009190816020015b606081526020019060019003908161082f579050509050600061085184611036565b604051630862026560e41b81526004810186905261eeee60248201529091506000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690638620265090604401602060405180830381865afa1580156108c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108e891906135a0565b90506001600160a01b03811661090b5761090285836112ba565b95945050505050565b81826109178784611323565b61092184896113e7565b61092a896117dc565b60405160200161093e9594939291906135d9565b60405160208183030381529060405283600081518110610960576109606137ae565b60209081029190910101526040516331a9108f60e11b8152600481018690526000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690636352211e90602401602060405180830381865afa1580156109d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f791906135a0565b9050610a61610a5c610a56610a0c8987611877565b8986610a5060006040518060400160405280601c81526020017f2020e1b498ca806fe1b48ae1b48763e1b49b206f77c9b4e1b487ca8000000000815250601c6119b5565b87611b28565b88611c45565b611dae565b84600181518110610a7457610a746137ae565b602002602001018190525050505060006040518060400160405280601d81526020017f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c000000815250610b3483600081518110610ad057610ad06137ae565b602002602001015184600181518110610aeb57610aeb6137ae565b602002602001015160405180604001604052806002815260200161227d60f01b815250604051602001610b20939291906137c4565b604051602081830303815290604052611dae565b604051602001610b45929190613807565b60408051601f19818403018152919052949350505050565b610b65610d59565b6001600160a01b038116610bcf5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b610bd881610fe6565b50565b336001600160a01b03841614801590610c8f575060405163c161c93f60e01b81523360048201526001600160a01b03848116602483015260448201849052606482018390527f0000000000000000000000000000000000000000000000000000000000000000169063c161c93f90608401602060405180830381865afa158015610c69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8d9190613836565b155b8015610d36575060405163c161c93f60e01b81523360048201526001600160a01b03848116602483015260006044830152606482018390527f0000000000000000000000000000000000000000000000000000000000000000169063c161c93f90608401602060405180830381865afa158015610d10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d349190613836565b155b15610d545760405163075fd2b160e01b815260040160405180910390fd5b505050565b6000546001600160a01b031633146106085760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610bc6565b8051600090829082610dc76006600161386e565b60ff16821480610de45750610dde6003600161386e565b60ff1682145b8015610e1557508251602360f81b908490600090610e0457610e046137ae565b01602001516001600160f81b031916145b15610e2257506000190160015b6005198201610f2a57600080826005019050610e56858281518110610e4957610e496137ae565b016020015160f81c611f13565b60e81b821791506004610e7b86836001900393508381518110610e4957610e496137ae565b901b60e81b821791506008610ea286836001900393508381518110610e4957610e496137ae565b901b60e81b82179150600c610ec986836001900393508381518110610e4957610e496137ae565b901b60e81b821791506010610ef086836001900393508381518110610e4957610e496137ae565b901b60e81b821791506014610f1786836001900393508381518110610e4957610e496137ae565b901b60e81b919091179695505050505050565b6002198201610fcd576000808260020190506000610f53868381518110610e4957610e496137ae565b9050600481901b811760e81b83179250610f7f86836001900393508381518110610e4957610e496137ae565b9050600c81901b600882901b1760e81b83179250610faf86836001900393508381518110610e4957610e496137ae565b601081901b60149190911b1760e81b92909217979650505050505050565b6040516393d3193d60e01b815260040160405180910390fd5b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60608060405180602001604052806000815250604051602001611059919061355b565b60408051601f19818403018152908290528051602090910120634949198760e01b825260048201859052906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690634949198790602401600060405180830381865afa1580156110d5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526110fd91908101906138b7565b60405160200161110d919061355b565b60405160208183030381529060405280519060200120146111db57604051634949198760e01b8152600481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690634949198790602401600060405180830381865afa15801561118d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526111b591908101906138b7565b6040516020016111c59190613900565b6040516020818303038152906040529050611206565b6111e483611f95565b6040516020016111f49190613929565b60405160208183030381529060405290505b601a815111156112b4576040516365d4a0a360e01b815273b57439a1e9cde287c63cc791478bef6bdb40edbf906365d4a0a39061124d908490600090601a9060040161395a565b600060405180830381865af415801561126a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261129291908101906138b7565b6040516020016112a2919061397f565b60405160208183030381529060405290505b92915050565b60606040518060400160405280601d81526020017f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c000000815250611312838461130087611f95565b604051602001610b20939291906139a6565b6040516020016112a2929190613807565b60606000670de0b6b3a764000061133985612028565b604051627eeac760e11b81526001600160a01b03868116600483015260248201889052919091169062fdd58e90604401602060405180830381865afa158015611386573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113aa9190613b2f565b6113b49190613b5e565b90506113bf81611f95565b6040516020016113cf9190613b72565b60405160208183030381529060405291505092915050565b604051632cee6deb60e01b8152600481018290526060906000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690632cee6deb90602401602060405180830381865afa158015611452573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114769190613b2f565b604051632eec7b5560e11b8152600481018590529091506000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690635dd8f6aa90602401602060405180830381865afa1580156114e1573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061150591906135a0565b90506000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316036116455760007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a29a68146040518163ffffffff1660e01b8152600401602060405180830381865afa1580156115a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c791906135a0565b604051630e8db21360e41b81529091506001600160a01b0382169063e8db2130906115fe908a9089908d9061eeee90600401613b9d565b6040805180830381865afa15801561161a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061163e9190613bc4565b9093509150505b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b03160361171857604051630e8db21360e41b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063e8db2130906116d290899088908c9061eeee90600401613b9d565b6040805180830381865afa1580156116ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117129190613bc4565b90925090505b6002600160e81b0319820161174e576040518060400160405280600381526020016271444f60e91b8152509450505050506112b4565b60608160011461177757506040805180820190915260018152600960fa1b602082015280611793565b50604080518082019091526002815261674f60f11b6020820152805b50806117af6117aa670de0b6b3a764000086613b5e565b611f95565b6040516020016117c0929190613807565b6040516020818303038152906040529550505050505092915050565b606060006117e98361211d565b9050611870670de0b6b3a7640000826001600160a01b03166375b0d9cd866040518263ffffffff1660e01b815260040161182591815260200190565b602060405180830381865afa158015611842573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118669190613b2f565b6117aa9190613b5e565b9392505050565b60008281526001602081905260408220546060929160ff9091161515146118c7576000805260016020527fa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb496118d6565b60008481526001602052604090205b60408051608081018252915460ff8116151583526001600160e81b0319610100820460e890811b821660208601526401000000008304811b821693850193909352600160381b90910490911b1660608201529050611932612328565b61194982602001516001600160e81b0319166123ed565b61196083604001516001600160e81b0319166123ed565b61197784602001516001600160e81b0319166123ed565b60405160200161198a9493929190613be8565b6040516020818303038152906040526119a285611f95565b846040516020016113cf93929190613e92565b81516060908281036119ca5783915050611870565b82811115611a875773b57439a1e9cde287c63cc791478bef6bdb40edbf6365d4a0a38560006119fa600188613ff0565b6040518463ffffffff1660e01b8152600401611a189392919061395a565b600060405180830381865af4158015611a35573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611a5d91908101906138b7565b604051602001611a6d919061397f565b604051602081830303815290604052935083915050611870565b60606000611a958386613ff0565b905060005b81811015611acd5782604051602001611ab39190614003565b60408051601f198184030181529190529250600101611a9a565b5086611afa578582604051602001611ae6929190613807565b604051602081830303815290604052611b1d565b8186604051602001611b0d929190613807565b6040516020818303038152906040525b979650505050505050565b6040516321d1336160e11b8152600481018590526060906000906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906343a266c29060240161012060405180830381865afa158015611b94573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bb89190614033565b905086611bc482612582565b611bce87896125bd565b604051602001611be0939291906140b3565b604051602081830303815290604052611bf98688612714565b611c0288612c30565b86611c0c87612d6a565b611c1588612ea9565b604051602001611c2a969594939291906141b9565b60405160208183030381529060405291505095945050505050565b60008181526001602081905260408220546060929160ff909116151514611c95576000805260016020527fa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb49611ca4565b60008381526001602052604090205b60408051608081018252915460ff8116151583526001600160e81b0319610100820460e890811b8216602086018190526401000000008404821b831694860194909452600160381b90920490911b1660608301529091508490611d06906123ed565b611d1d83604001516001600160e81b0319166123ed565b611d3484606001516001600160e81b0319166123ed565b604051602001611d479493929190614307565b604051602081830303815290604052611d6d82604001516001600160e81b0319166123ed565b611d8483604001516001600160e81b0319166123ed565b611d9b84606001516001600160e81b0319166123ed565b6040516020016113cf94939291906148cf565b60608151600003611dcd57505060408051602081019091526000815290565b6000604051806060016040528060408152602001614da26040913990506000600384516002611dfc9190614a19565b611e069190613b5e565b611e11906004614a2c565b90506000611e20826020614a19565b67ffffffffffffffff811115611e3857611e38613302565b6040519080825280601f01601f191660200182016040528015611e62576020820181803683370190505b509050818152600183018586518101602084015b81831015611ece576003830192508251603f8160121c168501518253600182019150603f81600c1c168501518253600182019150603f8160061c168501518253600182019150603f8116850151825350600101611e76565b600389510660018114611ee85760028114611ef957611f05565b613d3d60f01b600119830152611f05565b603d60f81b6000198301525b509398975050505050505050565b600060308260ff1610158015611f2d575060398260ff1611155b15611f3d57603082039150611f8e565b60418260ff1610158015611f55575060468260ff1611155b15611f6557603782039150611f8e565b6040516303bc56bd60e21b81526001600160f81b031960f884901b166004820152602401610bc6565b5060ff1690565b60606000611fa283612fd0565b600101905060008167ffffffffffffffff811115611fc257611fc2613302565b6040519080825280601f01601f191660200182016040528015611fec576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084611ff657509392505050565b604051630862026560e41b81526004810182905261eeee60248201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690638620265090604401602060405180830381865afa158015612098573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120bc91906135a0565b6001600160a01b031663975057e76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156120f9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112b491906135a0565b604051632eec7b5560e11b81526004810182905260009081906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690635dd8f6aa90602401602060405180830381865afa158015612187573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121ab91906135a0565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b031603612255576000819050806001600160a01b031663619306306040518163ffffffff1660e01b8152600401602060405180830381865afa158015612229573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061224d91906135a0565b949350505050565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b0316036122d1576000819050806001600160a01b031663619306306040518163ffffffff1660e01b8152600401602060405180830381865afa158015612229573d6000803e3d6000fd5b60405162461bcd60e51b815260206004820152602660248201527f676574546f6b656e53746f72653a20554e5245434f474e495a45445f434f4e546044820152652927a62622a960d11b6064820152608401610bc6565b6040805180820182526101f481528151808301835260068152651b9bdc9b585b60d21b602082810191909152820152905163bf6519ad60e01b81526060916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163bf6519ad916123a391600401614a43565b600060405180830381865afa1580156123c0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526123e891908101906138b7565b905090565b604080516006808252818301909252606091600091906020820181803683370190505090506124218360e81c600f166130a8565b60f81b81600581518110612437576124376137ae565b60200101906001600160f81b031916908160001a90535061245e600f60ec85901c166130a8565b60f81b81600481518110612474576124746137ae565b60200101906001600160f81b031916908160001a90535061249b600f60f085901c166130a8565b60f81b816003815181106124b1576124b16137ae565b60200101906001600160f81b031916908160001a9053506124d8600f60f485901c166130a8565b60f81b816002815181106124ee576124ee6137ae565b60200101906001600160f81b031916908160001a905350612515600f60f885901c166130a8565b60f81b8160018151811061252b5761252b6137ae565b60200101906001600160f81b031916908160001a90535061254f60fc84901c6130a8565b60f81b81600081518110612565576125656137ae565b60200101906001600160f81b031916908160001a90535092915050565b606061258d826130c5565b61259683613103565b6040516020016125a7929190613807565b6040516020818303038152906040529050919050565b60606000670de0b6b3a76400006125d384612028565b604051627eeac760e11b81526001600160a01b03878116600483015260248201879052919091169062fdd58e90604401602060405180830381865afa158015612620573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126449190613b2f565b61264e9190613b5e565b90506000612686600161266084611f95565b6040516020016126709190613b72565b604051602081830303815290604052600e6119b5565b6040516020016126969190614a68565b60408051601f19818403018152828201909152601782527f2020ca99e1b480ca9fe1b480c9b463e1b4872020202020000000000000000000602083015291506000906126e590829060186119b5565b905080826040516020016126fa929190613807565b604051602081830303815290604052935050505092915050565b604051632cee6deb60e01b8152600481018290526060906000906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690632cee6deb90602401602060405180830381865afa15801561277f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127a39190613b2f565b9050606060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316635dd8f6aa866040518263ffffffff1660e01b81526004016127f791815260200190565b602060405180830381865afa158015612814573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061283891906135a0565b90506000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b0316036129785760007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663a29a68146040518163ffffffff1660e01b8152600401602060405180830381865afa1580156128d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128fa91906135a0565b604051630e8db21360e41b81529091506001600160a01b0382169063e8db213090612931908b908a908e9061eeee90600401613b9d565b6040805180830381865afa15801561294d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129719190613bc4565b9093509150505b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316836001600160a01b031603612a4b57604051630e8db21360e41b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063e8db213090612a05908a9089908d9061eeee90600401613b9d565b6040805180830381865afa158015612a21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a459190613bc4565b90925090505b6002600160e81b03198201612aef57612a8f60006040518060400160405280601081526020016f2020e1b498e1b480ca8f6f75e1b49b7360801b81525060166119b5565b612ac36001604051602001612aad906271444f60e91b815260030190565b604051602081830303815290604052600f6119b5565b604051602001612ad4929190613807565b604051602081830303815290604052955050505050506112b4565b80600103612b195760405180604001604052806002815260200161674f60f11b8152509350612b36565b604051806040016040528060018152602001600960fa1b81525093505b600084612b4e6117aa670de0b6b3a764000086613b5e565b604051602001612b5f929190613807565b60405160208183030381529060405290506000612b8b6001838851600c612b869190614a19565b6119b5565b604051602001612b9b9190614a68565b60408051601f19818403018152828201909152601082526f2020e1b498e1b480ca8f6f75e1b49b7360801b60208301529150600090612bdd90829060166119b5565b604051602001612bed9190614a8e565b60405160208183030381529060405290508082604051602001612c11929190613807565b6040516020818303038152906040529850505050505050505092915050565b60606000612c3d8361211d565b90506000670de0b6b3a7640000826001600160a01b03166375b0d9cd866040518263ffffffff1660e01b8152600401612c7891815260200190565b602060405180830381865afa158015612c95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cb99190613b2f565b612cc39190613b5e565b90506000612cdc6001612cd584611f95565b600d6119b5565b604051602001612cec9190614a68565b60408051601f19818403018152828201909152601b82527f2020e1b49b6fe1b48be1b487c9b4207375e1b498e1b498ca9fca8f000000000060208301529150600090612d3b908290601c6119b5565b90508082604051602001612d50929190613807565b604051602081830303815290604052945050505050919050565b60408051602880825260608281019093526000919060208201818036833701905050905060005b6014811015612ea2576000612da7826013613ff0565b612db2906008614a2c565b612dbd906002614b8e565b612dd0906001600160a01b038716613b5e565b60f81b9050600060108260f81c612de79190614b9a565b60f81b905060008160f81c6010612dfe9190614bbc565b8360f81c612e0c9190614bd8565b60f81b9050612e1a826132ae565b85612e26866002614a2c565b81518110612e3657612e366137ae565b60200101906001600160f81b031916908160001a905350612e56816132ae565b85612e62866002614a2c565b612e6d906001614a19565b81518110612e7d57612e7d6137ae565b60200101906001600160f81b031916908160001a905350836001019350505050612d91565b5092915050565b606073b57439a1e9cde287c63cc791478bef6bdb40edbf6365d4a0a3612ece84612d6a565b600060046040518463ffffffff1660e01b8152600401612ef09392919061395a565b600060405180830381865af4158015612f0d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612f3591908101906138b7565b73b57439a1e9cde287c63cc791478bef6bdb40edbf6365d4a0a3612f5885612d6a565b602460286040518463ffffffff1660e01b8152600401612f7a9392919061395a565b600060405180830381865af4158015612f97573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612fbf91908101906138b7565b6040516020016125a7929190614bf1565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b831061300f5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef8100000000831061303b576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061305957662386f26fc10000830492506010015b6305f5e1008310613071576305f5e100830492506008015b612710831061308557612710830492506004015b60648310613097576064830492506002015b600a83106112b45760010192915050565b600060098260ff16116130be57816030016112b4565b5060370190565b805160609060006130d582611f95565b905061224d6000826040516020016130ed9190614c3d565b60405160208183030381529060405260136119b5565b6060818101516080830151600083808383036131825761315c60016040516020016131469071ee80b120c9b46fe1b49b2073e1b487e1b49b60701b815260120190565b60405160208183030381529060405260166119b5565b60405160200161316c9190614a68565b60405160208183030381529060405291506132a4565b4261318d8587614a19565b6131979190613ff0565b92506202a3008311156131e2576131b46117aa6201518085613b5e565b905061315c6001826040516020016131cc9190614c72565b60405160208183030381529060405260146119b5565b611c20831115613229576131fb6117aa610e1085613b5e565b905061315c6001826040516020016132139190614cbc565b60405160208183030381529060405260116119b5565b607883111561326e576132406117aa603c85613b5e565b905061315c6001826040516020016132589190614d04565b60405160208183030381529060405260176119b5565b61327c6117aa600185613b5e565b90506132946001826040516020016131cc9190614d54565b604051602001611c2a9190614a68565b5095945050505050565b6000600a60f883901c10156132d5576132cc60f883901c603061386e565b60f81b92915050565b6132cc60f883901c605761386e565b919050565b6000602082840312156132fb57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051610120810167ffffffffffffffff8111828210171561333c5761333c613302565b60405290565b604051601f8201601f1916810167ffffffffffffffff8111828210171561336b5761336b613302565b604052919050565b600067ffffffffffffffff82111561338d5761338d613302565b50601f01601f191660200190565b600082601f8301126133ac57600080fd5b81356133bf6133ba82613373565b613342565b8181528460208386010111156133d457600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121561340657600080fd5b833567ffffffffffffffff8082111561341e57600080fd5b61342a8783880161339b565b9450602086013591508082111561344057600080fd5b61344c8783880161339b565b9350604086013591508082111561346257600080fd5b5061346f8682870161339b565b9150509250925092565b6000806000806080858703121561348f57600080fd5b84359350602085013567ffffffffffffffff808211156134ae57600080fd5b6134ba8883890161339b565b945060408701359150808211156134d057600080fd5b6134dc8883890161339b565b935060608701359150808211156134f257600080fd5b506134ff8782880161339b565b91505092959194509250565b60005b8381101561352657818101518382015260200161350e565b50506000910152565b6000815180845261354781602086016020860161350b565b601f01601f19169290920160200192915050565b602081526000611870602083018461352f565b6001600160a01b0381168114610bd857600080fd5b60006020828403121561359557600080fd5b81356118708161356e565b6000602082840312156135b257600080fd5b81516118708161356e565b600081516135cf81856020860161350b565b9290920192915050565b683d913730b6b2911d1160b91b815285516000906135fe816009850160208b0161350b565b71111610113232b9b1b934b83a34b7b7111d1160711b600991840191820152865161363081601b840160208b0161350b565b7f20697320612070726f6a656374206f6e20746865204a75696365626f78205072601b9290910191820152681bdd1bd8dbdb0b888b60ba1b603b8201526d2261747472696275746573223a5b60901b60448201527f7b2274726169745f74797065223a2242616c616e6365222c2276616c7565223a6052820152601160f91b60728201526137a261376d61375d61375761371f6136d76137196136e68260738a018f6135bd565b62089f4b60ea1b815260030190565b7f7b2274726169745f74797065223a225061796f757473222c2276616c7565223a8152601160f91b602082015260210190565b8b6135bd565b7f7b2274726169745f74797065223a22546f6b656e20537570706c79222c227661815265363ab2911d1160d11b602082015260260190565b876135bd565b63089f574b60e21b815260040190565b7f22696d616765223a22646174613a696d6167652f7376672b786d6c3b626173658152620d8d0b60ea1b602082015260230190565b98975050505050505050565b634e487b7160e01b600052603260045260246000fd5b600084516137d681846020890161350b565b8451908301906137ea81836020890161350b565b84519101906137fd81836020880161350b565b0195945050505050565b6000835161381981846020880161350b565b83519083019061382d81836020880161350b565b01949350505050565b60006020828403121561384857600080fd5b8151801515811461187057600080fd5b634e487b7160e01b600052601160045260246000fd5b60ff81811683821601908111156112b4576112b4613858565b60006138956133ba84613373565b90508281528383830111156138a957600080fd5b61187083602083018461350b565b6000602082840312156138c957600080fd5b815167ffffffffffffffff8111156138e057600080fd5b8201601f810184136138f157600080fd5b61224d84825160208401613887565b600160fe1b81526000825161391c81600185016020870161350b565b9190910160010192915050565b6850726f6a656374202360b81b81526000825161394d81600985016020870161350b565b9190910160090192915050565b60608152600061396d606083018661352f565b60208301949094525060400152919050565b6000825161399181846020870161350b565b6271405360e91b920191825250600301919050565b683d913730b6b2911d1160b91b815283516000906139cb81600985016020890161350b565b71111610113232b9b1b934b83a34b7b7111d1160711b60099184019182015284516139fd81601b84016020890161350b565b7f20697320612070726f6a656374206f6e20746865204a75696365626f78205072601b92909101918201527f6f746f636f6c2e205468652070726f6a656374206f776e6572206d7573742075603b8201527f70677261646520746869732070726f6a65637420746f20563320746f20656e61605b8201527f626c652074686973204e4654277320696d6167652e2056697369742068747470607b8201527f733a2f2f6a75696365626f782e6d6f6e65792f76322f702f0000000000000000609b8201528351613ad38160b384016020880161350b565b611b1d613b2160b3838501017f2f73657474696e67733f706167653d757067726164657320746f20757067726181526f3232903a3434b990383937b532b1ba1760811b602082015260300190565b61227d60f01b815260020190565b600060208284031215613b4157600080fd5b5051919050565b634e487b7160e01b600052601260045260246000fd5b600082613b6d57613b6d613b48565b500490565b61674f60f11b81528151600090613b9081600285016020870161350b565b9190910160020192915050565b93845260208401929092526001600160a01b03908116604084015216606082015260800190565b60008060408385031215613bd757600080fd5b505080516020909101519092909150565b7f3c7376672077696474683d2232383922206865696768743d223135302220766981527f6577426f783d2230203020323839203135302220786d6c6e733d22687474703a60208201527f2f2f7777772e77332e6f72672f323030302f737667223e3c7374796c653e406660408201527f6f6e742d666163657b666f6e742d66616d696c793a2243617073756c65732d3560608201527f3030223b7372633a75726c28646174613a666f6e742f74727565747970653b636080820152731a185c9cd95d0f5d5d198b4e0ed8985cd94d8d0b60621b60a082015260008551613cd58160b4850160208a0161350b565b7f293b666f726d617428226f70656e7479706522293b7d612c613a76697369746560b4918401918201527f642c613a686f7665727b66696c6c3a696e68657269743b746578742d6465636f60d48201527f726174696f6e3a6e6f6e653b7d746578747b666f6e742d73697a653a3136707860f4820152663b66696c6c3a2360c81b610114820152611b1d613e8c613df1613deb613d7661011b86018b6135bd565b7f3b666f6e742d66616d696c793a2243617073756c65732d353030222c6d6f6e6f81527f73706163653b666f6e742d7765696768743a3530303b77686974652d7370616360208201527f653a7072653b7d236865616420746578747b66696c6c3a230000000000000000604082015260580190565b886135bd565b7f3b7d3c2f7374796c653e3c6720636c69702d706174683d2275726c2823636c6981527f703029223e3c7061746820643d224d323839203048305631353048323839563060208201527f5a222066696c6c3d2275726c28237061696e743029222f3e3c7265637420776960408201527f6474683d2232383922206865696768743d223232222066696c6c3d22230000006060820152607d0190565b856135bd565b60008451613ea481846020890161350b565b80830190507f222f3e3c672069643d2268656164222066696c7465723d2275726c282366696c81527f7465723229223e3c6120687265663d2268747470733a2f2f6a75696365626f7860208201526b2e6d6f6e65792f76322f702f60a01b60408201528451613f1a81604c84016020890161350b565b61111f60f11b604c9290910191820152731e3a32bc3a103c1e91189b11103c9e91189b111f60611b604e8201528351613f5a81606284016020880161350b565b7f3c2f746578743e3c2f613e3c6120687265663d2268747470733a2f2f6a756963910160628101919091527f65626f782e6d6f6e6579223e3c7465787420783d223235392e32352220793d22608282015263189b111f60e11b60a282015262ee808160e81b60a6820152613fe660a982016e1e17ba32bc3a1f1e17b09f1e17b39f60891b8152600f0190565b9695505050505050565b818103818111156112b4576112b4613858565b6000825161401581846020870161350b565b600160fd1b920191825250600101919050565b80516132e48161356e565b6000610120828403121561404657600080fd5b61404e613318565b825181526020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a082015260c083015160c082015261409a60e08401614028565b60e0820152610100928301519281019290925250919050565b600084516140c581846020890161350b565b80830190507f3c672066696c7465723d2275726c282366696c7465723129223e3c746578742081526c3c1e911811103c9e911a1c111f60991b6020820152845161411681602d84016020890161350b565b661e17ba32bc3a1f60c91b602d92909101918201819052721e3a32bc3a103c1e911811103c9e911b1a111f60691b60348301527f2020202020202020202020202020202020202020202020202020202020200000604783015260658201819052721e3a32bc3a103c1e911811103c9e911c18111f60691b606c83015284516141a581607f85016020890161350b565b607f92019182015260860195945050505050565b600087516141cb818460208c0161350b565b721e3a32bc3a103c1e911811103c9e911c9b111f60691b90830190815287516141fb816013840160208c0161350b565b661e17ba32bc3a1f60c91b601392909101918201819052731e3a32bc3a103c1e911811103c9e91189899111f60611b601a830152875161424281602e850160208c0161350b565b602e920191820152731e3a32bc3a103c1e911811103c9e9118991c111f60611b6035820152855161427a816049840160208a0161350b565b61010160f51b910160498101919091527f3c6120687265663d2268747470733a2f2f65746865727363616e2e696f2f6164604b8201526564726573732f60d01b606b8201526142fa6142ea6142e46142d6607185015b896135bd565b61111f60f11b815260020190565b866135bd565b631e17b09f60e11b815260040190565b9998505050505050505050565b60008551614319818460208a0161350b565b7f3c2f746578743e3c2f673e3c2f673e3c646566733e3c66696c7465722069643d9083019081527f2266696c746572312220783d222d332e33362220793d2232362e30342220776960208201527f6474683d2232393822206865696768743d22313530222066696c746572556e6960408201527f74733d227573657253706163654f6e5573652220636f6c6f722d696e7465727060608201527f6f6c6174696f6e2d66696c746572733d2273524742223e3c66654d6f7270686f60808201527f6c6f6779206f70657261746f723d2264696c61746522207261646975733d223060a08201527f2e312220696e3d22536f75726365416c7068612220726573756c743d2274686960c08201527f636b656e222f3e3c6665476175737369616e426c757220696e3d22746869636b60e08201527f656e2220737464446576696174696f6e3d22302e352220726573756c743d22626101008201527f6c7572726564222f3e3c6665466c6f6f6420666c6f6f642d636f6c6f723d2223610120820152611b1d6148956142e46147136142d06144b561014087018c6135bd565b7f2220726573756c743d22676c6f77436f6c6f72222f3e3c6665436f6d706f736981527f746520696e3d22676c6f77436f6c6f722220696e323d22626c7572726564222060208201527f6f70657261746f723d22696e2220726573756c743d22736f6674476c6f775f6360408201527f6f6c6f726564222f3e3c66654d657267653e3c66654d657267654e6f6465206960608201527f6e3d22736f6674476c6f775f636f6c6f726564222f3e3c66654d657267654e6f60808201527f646520696e3d22536f7572636547726170686963222f3e3c2f66654d6572676560a08201527f3e3c2f66696c7465723e3c66696c7465722069643d2266696c7465723222207860c08201527f3d22302220793d2230222077696474683d2232393822206865696768743d223160e08201527f3530222066696c746572556e6974733d227573657253706163654f6e557365226101008201527f20636f6c6f722d696e746572706f6c6174696f6e2d66696c746572733d2273526101208201527f4742223e3c66654d6f7270686f6c6f6779206f70657261746f723d2264696c616101408201527f746522207261646975733d22302e30352220696e3d22536f75726365416c70686101608201527f612220726573756c743d22746869636b656e222f3e3c6665476175737369616e6101808201527f426c757220696e3d22746869636b656e2220737464446576696174696f6e3d226101a08201527f302e32352220726573756c743d22626c7572726564222f3e3c6665466c6f6f646101c08201526e20666c6f6f642d636f6c6f723d222360881b6101e08201526101ef0190565b7f2220726573756c743d22676c6f77436f6c6f72222f3e3c6665436f6d706f736981527f746520696e3d22676c6f77436f6c6f722220696e323d22626c7572726564222060208201527f6f70657261746f723d22696e2220726573756c743d22736f6674476c6f775f6360408201527f6f6c6f726564222f3e3c66654d657267653e3c66654d657267654e6f6465206960608201527f6e3d22736f6674476c6f775f636f6c6f726564222f3e3c66654d657267654e6f60808201527f646520696e3d22536f7572636547726170686963222f3e3c2f66654d6572676560a08201527f3e3c2f66696c7465723e3c6c696e6561724772616469656e742069643d22706160c08201527f696e7430222078313d2230222079313d22323032222078323d2232383922207960e08201527f323d2232303222206772616469656e74556e6974733d227573657253706163656101008201527f4f6e557365223e3c73746f702073746f702d636f6c6f723d222300000000000061012082015261013a0190565b7f222f3e3c73746f70206f66667365743d22302e313139373932222073746f702d815267636f6c6f723d222360c01b602082015260280190565b600085516148e1818460208a0161350b565b8551908301906148f5818360208a0161350b565b8082019150507f222f3e3c73746f70206f66667365743d22302e383438393538222073746f702d815267636f6c6f723d222360c01b6020820152845161494281602884016020890161350b565b7f222f3e3c73746f70206f66667365743d2231222073746f702d636f6c6f723d2260289290910191820152602360f81b6048820152835161498a81604984016020880161350b565b7f222f3e3c2f6c696e6561724772616469656e743e3c636c697050617468206964604992909101918201527f3d22636c697030223e3c726563742077696474683d223238392220686569676860698201527f743d2231353022202f3e3c2f636c6970506174683e3c2f646566733e3c2f7376608982015261339f60f11b60a982015260ab019695505050505050565b808201808211156112b4576112b4613858565b80820281158282048414176112b4576112b4613858565b60208152815160208201526000602083015160408084015261224d606084018261352f565b60008251614a7a81846020870161350b565b61010160f51b920191825250600201919050565b60008251614aa081846020870161350b565b9190910192915050565b600181815b80851115614ae5578160001904821115614acb57614acb613858565b80851615614ad857918102915b93841c9390800290614aaf565b509250929050565b600082614afc575060016112b4565b81614b09575060006112b4565b8160018114614b1f5760028114614b2957614b45565b60019150506112b4565b60ff841115614b3a57614b3a613858565b50506001821b6112b4565b5060208310610133831016604e8410600b8410161715614b68575081810a6112b4565b614b728383614aaa565b8060001904821115614b8657614b86613858565b029392505050565b60006118708383614aed565b600060ff831680614bad57614bad613b48565b8060ff84160491505092915050565b60ff8181168382160290811690818114612ea257612ea2613858565b60ff82811682821603908111156112b4576112b4613858565b61060f60f31b815260008351614c0e81600285016020880161350b565b6271405360e91b6002918401918201528351614c3181600584016020880161350b565b01600501949350505050565b6b0101031e547b1e54ff0da43960a51b81528151600090614c6581600c85016020870161350b565b91909101600c0192915050565b62ee80b160e81b8152600160fd1b60038201528151600090614c9b81600485016020870161350b565b6920e1b485e1b480ca8f7360b01b6004939091019283015250600e01919050565b62ee80b160e81b8152600160fd1b60038201528151600090614ce581600485016020870161350b565b6720ca9c6f75ca807360c01b6004939091019283015250600c01919050565b62ee80b160e81b8152600160fd1b60038201528151600090614d2d81600485016020870161350b565b6f20e1b48dc9aac9b475e1b49be1b4877360801b6004939091019283015250601401919050565b62ee80b160e81b8152600160fd1b60038201528151600090614d7d81600485016020870161350b565b6c2073e1b487636fc9b4e1b4857360981b600493909101928301525060110191905056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa26469706673582212200c5414f520035620676e0ca24f20ff42b1098273c5821e2dae4e7f1c433908d264736f6c634300081100330000000000000000000000006f3c5afca0c9edf3926ef2ddf17c8ae6391afefb00000000000000000000000065572fb928b46f9adb7cfe5a4c41226f636161ea000000000000000000000000ffdd70c318915879d5192e8a0dcbfcb0285b3c9800000000000000000000000097a5b9d9f0f7cd676b69f584f29048d0ef4bb59b000000000000000000000000e3c01e9fd2a1dcc6edf0b1058b5757138ef9ffb6000000000000000000000000a77b7d93e79f1e6b4f77fab29d9ef85733a3d44a

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100ff5760003560e01c80639f3621dd11610097578063da0544aa11610066578063da0544aa14610337578063dfee225f14610357578063f2fde38b1461037e578063f77c47911461039157600080fd5b80639f3621dd146102af578063ad007d63146102d6578063be392d7e146102fd578063c41c2f241461031057600080fd5b8063715018a6116100d3578063715018a6146101975780637fc5e91d1461019f5780638b79543c146102775780638da5cb5b1461029e57600080fd5b8062073c191461010457806303b8747114610119578063557e71551461012c5780636ced113414610170575b600080fd5b6101176101123660046132e9565b6103b8565b005b6101176101273660046133f1565b6104ae565b6101537f0000000000000000000000006f18cf9173136c0b5a6ebf45f19d58d3ff2e17e681565b6040516001600160a01b0390911681526020015b60405180910390f35b6101537f00000000000000000000000097a5b9d9f0f7cd676b69f584f29048d0ef4bb59b81565b6101176105f6565b6102306101ad3660046132e9565b604080516080808201835260008083526020808401829052838501829052606093840182905294815260018552839020835191820184525460ff8116151582526001600160e81b0319610100820460e890811b8216968401969096526401000000008204861b811694830194909452600160381b900490931b9091169082015290565b60405161016791908151151581526020808301516001600160e81b031990811691830191909152604080840151821690830152606092830151169181019190915260800190565b6101537f000000000000000000000000d8b4359143eda5b2d763e127ed27c77addbc47d381565b6000546001600160a01b0316610153565b6101537f000000000000000000000000e3c01e9fd2a1dcc6edf0b1058b5757138ef9ffb681565b6101537f0000000000000000000000006f3c5afca0c9edf3926ef2ddf17c8ae6391afefb81565b61011761030b366004613479565b61060a565b6101537f00000000000000000000000065572fb928b46f9adb7cfe5a4c41226f636161ea81565b61034a6103453660046132e9565b610815565b604051610167919061355b565b6101537f000000000000000000000000a77b7d93e79f1e6b4f77fab29d9ef85733a3d44a81565b61011761038c366004613583565b610b5d565b6101537f000000000000000000000000ffdd70c318915879d5192e8a0dcbfcb0285b3c9881565b6040516331a9108f60e11b8152600481018290527f000000000000000000000000d8b4359143eda5b2d763e127ed27c77addbc47d36001600160a01b031690636352211e90602401602060405180830381865afa15801561041d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061044191906135a0565b81601461044f838383610bdb565b60008481526001602052604090819020805469ffffffffffffffffffff19169055517fba355f24c186f336fa45b38770b5ae76456ec3ce2f2818115a89890a98b7e535906104a09086815260200190565b60405180910390a150505050565b6104b6610d59565b60006104c184610db3565b905060006104ce84610db3565b905060006104db84610db3565b604080516080808201835260018083526001600160e81b031988811660208086018281528a8416878901818152948a166060808a01828152600080805298865299517fa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb498054955198519b5163ffffffff1990961691151563ffffff0019169190911761010060e8998a1c021769ffffffffffff0000000019166401000000009b891c9b909b0269ffffff0000000000000019169a909a17600160381b9490971c939093029590951790975587519485529084019190915294820193909352928301919091529192507fe0d41df1edcb26e1d1d7443cfe84d155389c0d9601d223399b7fb7f954313787910160405180910390a1505050505050565b6105fe610d59565b6106086000610fe6565b565b6040516331a9108f60e11b8152600481018590527f000000000000000000000000d8b4359143eda5b2d763e127ed27c77addbc47d36001600160a01b031690636352211e90602401602060405180830381865afa15801561066f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061069391906135a0565b8460146106a1838383610bdb565b60006106ac87610db3565b905060006106b987610db3565b905060006106c687610db3565b90506040518060800160405280600115158152602001846001600160e81b0319168152602001836001600160e81b0319168152602001826001600160e81b031916815250600160008c815260200190815260200160002060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a81548162ffffff021916908360e81c021790555060408201518160000160046101000a81548162ffffff021916908360e81c021790555060608201518160000160076101000a81548162ffffff021916908360e81c02179055509050507fe0d41df1edcb26e1d1d7443cfe84d155389c0d9601d223399b7fb7f9543137878a84848460405161080194939291909384526001600160e81b03199283166020850152908216604084015216606082015260800190565b60405180910390a150505050505050505050565b604080516002808252606082810190935260009190816020015b606081526020019060019003908161082f579050509050600061085184611036565b604051630862026560e41b81526004810186905261eeee60248201529091506000906001600160a01b037f00000000000000000000000065572fb928b46f9adb7cfe5a4c41226f636161ea1690638620265090604401602060405180830381865afa1580156108c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108e891906135a0565b90506001600160a01b03811661090b5761090285836112ba565b95945050505050565b81826109178784611323565b61092184896113e7565b61092a896117dc565b60405160200161093e9594939291906135d9565b60405160208183030381529060405283600081518110610960576109606137ae565b60209081029190910101526040516331a9108f60e11b8152600481018690526000906001600160a01b037f000000000000000000000000d8b4359143eda5b2d763e127ed27c77addbc47d31690636352211e90602401602060405180830381865afa1580156109d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f791906135a0565b9050610a61610a5c610a56610a0c8987611877565b8986610a5060006040518060400160405280601c81526020017f2020e1b498ca806fe1b48ae1b48763e1b49b206f77c9b4e1b487ca8000000000815250601c6119b5565b87611b28565b88611c45565b611dae565b84600181518110610a7457610a746137ae565b602002602001018190525050505060006040518060400160405280601d81526020017f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c000000815250610b3483600081518110610ad057610ad06137ae565b602002602001015184600181518110610aeb57610aeb6137ae565b602002602001015160405180604001604052806002815260200161227d60f01b815250604051602001610b20939291906137c4565b604051602081830303815290604052611dae565b604051602001610b45929190613807565b60408051601f19818403018152919052949350505050565b610b65610d59565b6001600160a01b038116610bcf5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b610bd881610fe6565b50565b336001600160a01b03841614801590610c8f575060405163c161c93f60e01b81523360048201526001600160a01b03848116602483015260448201849052606482018390527f0000000000000000000000006f3c5afca0c9edf3926ef2ddf17c8ae6391afefb169063c161c93f90608401602060405180830381865afa158015610c69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8d9190613836565b155b8015610d36575060405163c161c93f60e01b81523360048201526001600160a01b03848116602483015260006044830152606482018390527f0000000000000000000000006f3c5afca0c9edf3926ef2ddf17c8ae6391afefb169063c161c93f90608401602060405180830381865afa158015610d10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d349190613836565b155b15610d545760405163075fd2b160e01b815260040160405180910390fd5b505050565b6000546001600160a01b031633146106085760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610bc6565b8051600090829082610dc76006600161386e565b60ff16821480610de45750610dde6003600161386e565b60ff1682145b8015610e1557508251602360f81b908490600090610e0457610e046137ae565b01602001516001600160f81b031916145b15610e2257506000190160015b6005198201610f2a57600080826005019050610e56858281518110610e4957610e496137ae565b016020015160f81c611f13565b60e81b821791506004610e7b86836001900393508381518110610e4957610e496137ae565b901b60e81b821791506008610ea286836001900393508381518110610e4957610e496137ae565b901b60e81b82179150600c610ec986836001900393508381518110610e4957610e496137ae565b901b60e81b821791506010610ef086836001900393508381518110610e4957610e496137ae565b901b60e81b821791506014610f1786836001900393508381518110610e4957610e496137ae565b901b60e81b919091179695505050505050565b6002198201610fcd576000808260020190506000610f53868381518110610e4957610e496137ae565b9050600481901b811760e81b83179250610f7f86836001900393508381518110610e4957610e496137ae565b9050600c81901b600882901b1760e81b83179250610faf86836001900393508381518110610e4957610e496137ae565b601081901b60149190911b1760e81b92909217979650505050505050565b6040516393d3193d60e01b815260040160405180910390fd5b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60608060405180602001604052806000815250604051602001611059919061355b565b60408051601f19818403018152908290528051602090910120634949198760e01b825260048201859052906001600160a01b037f000000000000000000000000e3c01e9fd2a1dcc6edf0b1058b5757138ef9ffb61690634949198790602401600060405180830381865afa1580156110d5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526110fd91908101906138b7565b60405160200161110d919061355b565b60405160208183030381529060405280519060200120146111db57604051634949198760e01b8152600481018490527f000000000000000000000000e3c01e9fd2a1dcc6edf0b1058b5757138ef9ffb66001600160a01b031690634949198790602401600060405180830381865afa15801561118d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526111b591908101906138b7565b6040516020016111c59190613900565b6040516020818303038152906040529050611206565b6111e483611f95565b6040516020016111f49190613929565b60405160208183030381529060405290505b601a815111156112b4576040516365d4a0a360e01b815273b57439a1e9cde287c63cc791478bef6bdb40edbf906365d4a0a39061124d908490600090601a9060040161395a565b600060405180830381865af415801561126a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261129291908101906138b7565b6040516020016112a2919061397f565b60405160208183030381529060405290505b92915050565b60606040518060400160405280601d81526020017f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c000000815250611312838461130087611f95565b604051602001610b20939291906139a6565b6040516020016112a2929190613807565b60606000670de0b6b3a764000061133985612028565b604051627eeac760e11b81526001600160a01b03868116600483015260248201889052919091169062fdd58e90604401602060405180830381865afa158015611386573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113aa9190613b2f565b6113b49190613b5e565b90506113bf81611f95565b6040516020016113cf9190613b72565b60405160208183030381529060405291505092915050565b604051632cee6deb60e01b8152600481018290526060906000906001600160a01b037f0000000000000000000000006f18cf9173136c0b5a6ebf45f19d58d3ff2e17e61690632cee6deb90602401602060405180830381865afa158015611452573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114769190613b2f565b604051632eec7b5560e11b8152600481018590529091506000906001600160a01b037f00000000000000000000000065572fb928b46f9adb7cfe5a4c41226f636161ea1690635dd8f6aa90602401602060405180830381865afa1580156114e1573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061150591906135a0565b90506000807f00000000000000000000000097a5b9d9f0f7cd676b69f584f29048d0ef4bb59b6001600160a01b0316836001600160a01b0316036116455760007f00000000000000000000000097a5b9d9f0f7cd676b69f584f29048d0ef4bb59b6001600160a01b031663a29a68146040518163ffffffff1660e01b8152600401602060405180830381865afa1580156115a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c791906135a0565b604051630e8db21360e41b81529091506001600160a01b0382169063e8db2130906115fe908a9089908d9061eeee90600401613b9d565b6040805180830381865afa15801561161a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061163e9190613bc4565b9093509150505b7f000000000000000000000000ffdd70c318915879d5192e8a0dcbfcb0285b3c986001600160a01b0316836001600160a01b03160361171857604051630e8db21360e41b81526001600160a01b037f000000000000000000000000ffdd70c318915879d5192e8a0dcbfcb0285b3c98169063e8db2130906116d290899088908c9061eeee90600401613b9d565b6040805180830381865afa1580156116ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117129190613bc4565b90925090505b6002600160e81b0319820161174e576040518060400160405280600381526020016271444f60e91b8152509450505050506112b4565b60608160011461177757506040805180820190915260018152600960fa1b602082015280611793565b50604080518082019091526002815261674f60f11b6020820152805b50806117af6117aa670de0b6b3a764000086613b5e565b611f95565b6040516020016117c0929190613807565b6040516020818303038152906040529550505050505092915050565b606060006117e98361211d565b9050611870670de0b6b3a7640000826001600160a01b03166375b0d9cd866040518263ffffffff1660e01b815260040161182591815260200190565b602060405180830381865afa158015611842573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118669190613b2f565b6117aa9190613b5e565b9392505050565b60008281526001602081905260408220546060929160ff9091161515146118c7576000805260016020527fa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb496118d6565b60008481526001602052604090205b60408051608081018252915460ff8116151583526001600160e81b0319610100820460e890811b821660208601526401000000008304811b821693850193909352600160381b90910490911b1660608201529050611932612328565b61194982602001516001600160e81b0319166123ed565b61196083604001516001600160e81b0319166123ed565b61197784602001516001600160e81b0319166123ed565b60405160200161198a9493929190613be8565b6040516020818303038152906040526119a285611f95565b846040516020016113cf93929190613e92565b81516060908281036119ca5783915050611870565b82811115611a875773b57439a1e9cde287c63cc791478bef6bdb40edbf6365d4a0a38560006119fa600188613ff0565b6040518463ffffffff1660e01b8152600401611a189392919061395a565b600060405180830381865af4158015611a35573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611a5d91908101906138b7565b604051602001611a6d919061397f565b604051602081830303815290604052935083915050611870565b60606000611a958386613ff0565b905060005b81811015611acd5782604051602001611ab39190614003565b60408051601f198184030181529190529250600101611a9a565b5086611afa578582604051602001611ae6929190613807565b604051602081830303815290604052611b1d565b8186604051602001611b0d929190613807565b6040516020818303038152906040525b979650505050505050565b6040516321d1336160e11b8152600481018590526060906000906001600160a01b037f0000000000000000000000006f18cf9173136c0b5a6ebf45f19d58d3ff2e17e616906343a266c29060240161012060405180830381865afa158015611b94573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bb89190614033565b905086611bc482612582565b611bce87896125bd565b604051602001611be0939291906140b3565b604051602081830303815290604052611bf98688612714565b611c0288612c30565b86611c0c87612d6a565b611c1588612ea9565b604051602001611c2a969594939291906141b9565b60405160208183030381529060405291505095945050505050565b60008181526001602081905260408220546060929160ff909116151514611c95576000805260016020527fa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb49611ca4565b60008381526001602052604090205b60408051608081018252915460ff8116151583526001600160e81b0319610100820460e890811b8216602086018190526401000000008404821b831694860194909452600160381b90920490911b1660608301529091508490611d06906123ed565b611d1d83604001516001600160e81b0319166123ed565b611d3484606001516001600160e81b0319166123ed565b604051602001611d479493929190614307565b604051602081830303815290604052611d6d82604001516001600160e81b0319166123ed565b611d8483604001516001600160e81b0319166123ed565b611d9b84606001516001600160e81b0319166123ed565b6040516020016113cf94939291906148cf565b60608151600003611dcd57505060408051602081019091526000815290565b6000604051806060016040528060408152602001614da26040913990506000600384516002611dfc9190614a19565b611e069190613b5e565b611e11906004614a2c565b90506000611e20826020614a19565b67ffffffffffffffff811115611e3857611e38613302565b6040519080825280601f01601f191660200182016040528015611e62576020820181803683370190505b509050818152600183018586518101602084015b81831015611ece576003830192508251603f8160121c168501518253600182019150603f81600c1c168501518253600182019150603f8160061c168501518253600182019150603f8116850151825350600101611e76565b600389510660018114611ee85760028114611ef957611f05565b613d3d60f01b600119830152611f05565b603d60f81b6000198301525b509398975050505050505050565b600060308260ff1610158015611f2d575060398260ff1611155b15611f3d57603082039150611f8e565b60418260ff1610158015611f55575060468260ff1611155b15611f6557603782039150611f8e565b6040516303bc56bd60e21b81526001600160f81b031960f884901b166004820152602401610bc6565b5060ff1690565b60606000611fa283612fd0565b600101905060008167ffffffffffffffff811115611fc257611fc2613302565b6040519080825280601f01601f191660200182016040528015611fec576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084611ff657509392505050565b604051630862026560e41b81526004810182905261eeee60248201526000907f00000000000000000000000065572fb928b46f9adb7cfe5a4c41226f636161ea6001600160a01b031690638620265090604401602060405180830381865afa158015612098573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120bc91906135a0565b6001600160a01b031663975057e76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156120f9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112b491906135a0565b604051632eec7b5560e11b81526004810182905260009081906001600160a01b037f00000000000000000000000065572fb928b46f9adb7cfe5a4c41226f636161ea1690635dd8f6aa90602401602060405180830381865afa158015612187573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121ab91906135a0565b90507f000000000000000000000000ffdd70c318915879d5192e8a0dcbfcb0285b3c986001600160a01b0316816001600160a01b031603612255576000819050806001600160a01b031663619306306040518163ffffffff1660e01b8152600401602060405180830381865afa158015612229573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061224d91906135a0565b949350505050565b7f00000000000000000000000097a5b9d9f0f7cd676b69f584f29048d0ef4bb59b6001600160a01b0316816001600160a01b0316036122d1576000819050806001600160a01b031663619306306040518163ffffffff1660e01b8152600401602060405180830381865afa158015612229573d6000803e3d6000fd5b60405162461bcd60e51b815260206004820152602660248201527f676574546f6b656e53746f72653a20554e5245434f474e495a45445f434f4e546044820152652927a62622a960d11b6064820152608401610bc6565b6040805180820182526101f481528151808301835260068152651b9bdc9b585b60d21b602082810191909152820152905163bf6519ad60e01b81526060916001600160a01b037f000000000000000000000000a77b7d93e79f1e6b4f77fab29d9ef85733a3d44a169163bf6519ad916123a391600401614a43565b600060405180830381865afa1580156123c0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526123e891908101906138b7565b905090565b604080516006808252818301909252606091600091906020820181803683370190505090506124218360e81c600f166130a8565b60f81b81600581518110612437576124376137ae565b60200101906001600160f81b031916908160001a90535061245e600f60ec85901c166130a8565b60f81b81600481518110612474576124746137ae565b60200101906001600160f81b031916908160001a90535061249b600f60f085901c166130a8565b60f81b816003815181106124b1576124b16137ae565b60200101906001600160f81b031916908160001a9053506124d8600f60f485901c166130a8565b60f81b816002815181106124ee576124ee6137ae565b60200101906001600160f81b031916908160001a905350612515600f60f885901c166130a8565b60f81b8160018151811061252b5761252b6137ae565b60200101906001600160f81b031916908160001a90535061254f60fc84901c6130a8565b60f81b81600081518110612565576125656137ae565b60200101906001600160f81b031916908160001a90535092915050565b606061258d826130c5565b61259683613103565b6040516020016125a7929190613807565b6040516020818303038152906040529050919050565b60606000670de0b6b3a76400006125d384612028565b604051627eeac760e11b81526001600160a01b03878116600483015260248201879052919091169062fdd58e90604401602060405180830381865afa158015612620573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126449190613b2f565b61264e9190613b5e565b90506000612686600161266084611f95565b6040516020016126709190613b72565b604051602081830303815290604052600e6119b5565b6040516020016126969190614a68565b60408051601f19818403018152828201909152601782527f2020ca99e1b480ca9fe1b480c9b463e1b4872020202020000000000000000000602083015291506000906126e590829060186119b5565b905080826040516020016126fa929190613807565b604051602081830303815290604052935050505092915050565b604051632cee6deb60e01b8152600481018290526060906000906001600160a01b037f0000000000000000000000006f18cf9173136c0b5a6ebf45f19d58d3ff2e17e61690632cee6deb90602401602060405180830381865afa15801561277f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127a39190613b2f565b9050606060007f00000000000000000000000065572fb928b46f9adb7cfe5a4c41226f636161ea6001600160a01b0316635dd8f6aa866040518263ffffffff1660e01b81526004016127f791815260200190565b602060405180830381865afa158015612814573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061283891906135a0565b90506000807f00000000000000000000000097a5b9d9f0f7cd676b69f584f29048d0ef4bb59b6001600160a01b0316836001600160a01b0316036129785760007f00000000000000000000000097a5b9d9f0f7cd676b69f584f29048d0ef4bb59b6001600160a01b031663a29a68146040518163ffffffff1660e01b8152600401602060405180830381865afa1580156128d6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128fa91906135a0565b604051630e8db21360e41b81529091506001600160a01b0382169063e8db213090612931908b908a908e9061eeee90600401613b9d565b6040805180830381865afa15801561294d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129719190613bc4565b9093509150505b7f000000000000000000000000ffdd70c318915879d5192e8a0dcbfcb0285b3c986001600160a01b0316836001600160a01b031603612a4b57604051630e8db21360e41b81526001600160a01b037f000000000000000000000000ffdd70c318915879d5192e8a0dcbfcb0285b3c98169063e8db213090612a05908a9089908d9061eeee90600401613b9d565b6040805180830381865afa158015612a21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a459190613bc4565b90925090505b6002600160e81b03198201612aef57612a8f60006040518060400160405280601081526020016f2020e1b498e1b480ca8f6f75e1b49b7360801b81525060166119b5565b612ac36001604051602001612aad906271444f60e91b815260030190565b604051602081830303815290604052600f6119b5565b604051602001612ad4929190613807565b604051602081830303815290604052955050505050506112b4565b80600103612b195760405180604001604052806002815260200161674f60f11b8152509350612b36565b604051806040016040528060018152602001600960fa1b81525093505b600084612b4e6117aa670de0b6b3a764000086613b5e565b604051602001612b5f929190613807565b60405160208183030381529060405290506000612b8b6001838851600c612b869190614a19565b6119b5565b604051602001612b9b9190614a68565b60408051601f19818403018152828201909152601082526f2020e1b498e1b480ca8f6f75e1b49b7360801b60208301529150600090612bdd90829060166119b5565b604051602001612bed9190614a8e565b60405160208183030381529060405290508082604051602001612c11929190613807565b6040516020818303038152906040529850505050505050505092915050565b60606000612c3d8361211d565b90506000670de0b6b3a7640000826001600160a01b03166375b0d9cd866040518263ffffffff1660e01b8152600401612c7891815260200190565b602060405180830381865afa158015612c95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cb99190613b2f565b612cc39190613b5e565b90506000612cdc6001612cd584611f95565b600d6119b5565b604051602001612cec9190614a68565b60408051601f19818403018152828201909152601b82527f2020e1b49b6fe1b48be1b487c9b4207375e1b498e1b498ca9fca8f000000000060208301529150600090612d3b908290601c6119b5565b90508082604051602001612d50929190613807565b604051602081830303815290604052945050505050919050565b60408051602880825260608281019093526000919060208201818036833701905050905060005b6014811015612ea2576000612da7826013613ff0565b612db2906008614a2c565b612dbd906002614b8e565b612dd0906001600160a01b038716613b5e565b60f81b9050600060108260f81c612de79190614b9a565b60f81b905060008160f81c6010612dfe9190614bbc565b8360f81c612e0c9190614bd8565b60f81b9050612e1a826132ae565b85612e26866002614a2c565b81518110612e3657612e366137ae565b60200101906001600160f81b031916908160001a905350612e56816132ae565b85612e62866002614a2c565b612e6d906001614a19565b81518110612e7d57612e7d6137ae565b60200101906001600160f81b031916908160001a905350836001019350505050612d91565b5092915050565b606073b57439a1e9cde287c63cc791478bef6bdb40edbf6365d4a0a3612ece84612d6a565b600060046040518463ffffffff1660e01b8152600401612ef09392919061395a565b600060405180830381865af4158015612f0d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612f3591908101906138b7565b73b57439a1e9cde287c63cc791478bef6bdb40edbf6365d4a0a3612f5885612d6a565b602460286040518463ffffffff1660e01b8152600401612f7a9392919061395a565b600060405180830381865af4158015612f97573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612fbf91908101906138b7565b6040516020016125a7929190614bf1565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b831061300f5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef8100000000831061303b576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061305957662386f26fc10000830492506010015b6305f5e1008310613071576305f5e100830492506008015b612710831061308557612710830492506004015b60648310613097576064830492506002015b600a83106112b45760010192915050565b600060098260ff16116130be57816030016112b4565b5060370190565b805160609060006130d582611f95565b905061224d6000826040516020016130ed9190614c3d565b60405160208183030381529060405260136119b5565b6060818101516080830151600083808383036131825761315c60016040516020016131469071ee80b120c9b46fe1b49b2073e1b487e1b49b60701b815260120190565b60405160208183030381529060405260166119b5565b60405160200161316c9190614a68565b60405160208183030381529060405291506132a4565b4261318d8587614a19565b6131979190613ff0565b92506202a3008311156131e2576131b46117aa6201518085613b5e565b905061315c6001826040516020016131cc9190614c72565b60405160208183030381529060405260146119b5565b611c20831115613229576131fb6117aa610e1085613b5e565b905061315c6001826040516020016132139190614cbc565b60405160208183030381529060405260116119b5565b607883111561326e576132406117aa603c85613b5e565b905061315c6001826040516020016132589190614d04565b60405160208183030381529060405260176119b5565b61327c6117aa600185613b5e565b90506132946001826040516020016131cc9190614d54565b604051602001611c2a9190614a68565b5095945050505050565b6000600a60f883901c10156132d5576132cc60f883901c603061386e565b60f81b92915050565b6132cc60f883901c605761386e565b919050565b6000602082840312156132fb57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051610120810167ffffffffffffffff8111828210171561333c5761333c613302565b60405290565b604051601f8201601f1916810167ffffffffffffffff8111828210171561336b5761336b613302565b604052919050565b600067ffffffffffffffff82111561338d5761338d613302565b50601f01601f191660200190565b600082601f8301126133ac57600080fd5b81356133bf6133ba82613373565b613342565b8181528460208386010111156133d457600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121561340657600080fd5b833567ffffffffffffffff8082111561341e57600080fd5b61342a8783880161339b565b9450602086013591508082111561344057600080fd5b61344c8783880161339b565b9350604086013591508082111561346257600080fd5b5061346f8682870161339b565b9150509250925092565b6000806000806080858703121561348f57600080fd5b84359350602085013567ffffffffffffffff808211156134ae57600080fd5b6134ba8883890161339b565b945060408701359150808211156134d057600080fd5b6134dc8883890161339b565b935060608701359150808211156134f257600080fd5b506134ff8782880161339b565b91505092959194509250565b60005b8381101561352657818101518382015260200161350e565b50506000910152565b6000815180845261354781602086016020860161350b565b601f01601f19169290920160200192915050565b602081526000611870602083018461352f565b6001600160a01b0381168114610bd857600080fd5b60006020828403121561359557600080fd5b81356118708161356e565b6000602082840312156135b257600080fd5b81516118708161356e565b600081516135cf81856020860161350b565b9290920192915050565b683d913730b6b2911d1160b91b815285516000906135fe816009850160208b0161350b565b71111610113232b9b1b934b83a34b7b7111d1160711b600991840191820152865161363081601b840160208b0161350b565b7f20697320612070726f6a656374206f6e20746865204a75696365626f78205072601b9290910191820152681bdd1bd8dbdb0b888b60ba1b603b8201526d2261747472696275746573223a5b60901b60448201527f7b2274726169745f74797065223a2242616c616e6365222c2276616c7565223a6052820152601160f91b60728201526137a261376d61375d61375761371f6136d76137196136e68260738a018f6135bd565b62089f4b60ea1b815260030190565b7f7b2274726169745f74797065223a225061796f757473222c2276616c7565223a8152601160f91b602082015260210190565b8b6135bd565b7f7b2274726169745f74797065223a22546f6b656e20537570706c79222c227661815265363ab2911d1160d11b602082015260260190565b876135bd565b63089f574b60e21b815260040190565b7f22696d616765223a22646174613a696d6167652f7376672b786d6c3b626173658152620d8d0b60ea1b602082015260230190565b98975050505050505050565b634e487b7160e01b600052603260045260246000fd5b600084516137d681846020890161350b565b8451908301906137ea81836020890161350b565b84519101906137fd81836020880161350b565b0195945050505050565b6000835161381981846020880161350b565b83519083019061382d81836020880161350b565b01949350505050565b60006020828403121561384857600080fd5b8151801515811461187057600080fd5b634e487b7160e01b600052601160045260246000fd5b60ff81811683821601908111156112b4576112b4613858565b60006138956133ba84613373565b90508281528383830111156138a957600080fd5b61187083602083018461350b565b6000602082840312156138c957600080fd5b815167ffffffffffffffff8111156138e057600080fd5b8201601f810184136138f157600080fd5b61224d84825160208401613887565b600160fe1b81526000825161391c81600185016020870161350b565b9190910160010192915050565b6850726f6a656374202360b81b81526000825161394d81600985016020870161350b565b9190910160090192915050565b60608152600061396d606083018661352f565b60208301949094525060400152919050565b6000825161399181846020870161350b565b6271405360e91b920191825250600301919050565b683d913730b6b2911d1160b91b815283516000906139cb81600985016020890161350b565b71111610113232b9b1b934b83a34b7b7111d1160711b60099184019182015284516139fd81601b84016020890161350b565b7f20697320612070726f6a656374206f6e20746865204a75696365626f78205072601b92909101918201527f6f746f636f6c2e205468652070726f6a656374206f776e6572206d7573742075603b8201527f70677261646520746869732070726f6a65637420746f20563320746f20656e61605b8201527f626c652074686973204e4654277320696d6167652e2056697369742068747470607b8201527f733a2f2f6a75696365626f782e6d6f6e65792f76322f702f0000000000000000609b8201528351613ad38160b384016020880161350b565b611b1d613b2160b3838501017f2f73657474696e67733f706167653d757067726164657320746f20757067726181526f3232903a3434b990383937b532b1ba1760811b602082015260300190565b61227d60f01b815260020190565b600060208284031215613b4157600080fd5b5051919050565b634e487b7160e01b600052601260045260246000fd5b600082613b6d57613b6d613b48565b500490565b61674f60f11b81528151600090613b9081600285016020870161350b565b9190910160020192915050565b93845260208401929092526001600160a01b03908116604084015216606082015260800190565b60008060408385031215613bd757600080fd5b505080516020909101519092909150565b7f3c7376672077696474683d2232383922206865696768743d223135302220766981527f6577426f783d2230203020323839203135302220786d6c6e733d22687474703a60208201527f2f2f7777772e77332e6f72672f323030302f737667223e3c7374796c653e406660408201527f6f6e742d666163657b666f6e742d66616d696c793a2243617073756c65732d3560608201527f3030223b7372633a75726c28646174613a666f6e742f74727565747970653b636080820152731a185c9cd95d0f5d5d198b4e0ed8985cd94d8d0b60621b60a082015260008551613cd58160b4850160208a0161350b565b7f293b666f726d617428226f70656e7479706522293b7d612c613a76697369746560b4918401918201527f642c613a686f7665727b66696c6c3a696e68657269743b746578742d6465636f60d48201527f726174696f6e3a6e6f6e653b7d746578747b666f6e742d73697a653a3136707860f4820152663b66696c6c3a2360c81b610114820152611b1d613e8c613df1613deb613d7661011b86018b6135bd565b7f3b666f6e742d66616d696c793a2243617073756c65732d353030222c6d6f6e6f81527f73706163653b666f6e742d7765696768743a3530303b77686974652d7370616360208201527f653a7072653b7d236865616420746578747b66696c6c3a230000000000000000604082015260580190565b886135bd565b7f3b7d3c2f7374796c653e3c6720636c69702d706174683d2275726c2823636c6981527f703029223e3c7061746820643d224d323839203048305631353048323839563060208201527f5a222066696c6c3d2275726c28237061696e743029222f3e3c7265637420776960408201527f6474683d2232383922206865696768743d223232222066696c6c3d22230000006060820152607d0190565b856135bd565b60008451613ea481846020890161350b565b80830190507f222f3e3c672069643d2268656164222066696c7465723d2275726c282366696c81527f7465723229223e3c6120687265663d2268747470733a2f2f6a75696365626f7860208201526b2e6d6f6e65792f76322f702f60a01b60408201528451613f1a81604c84016020890161350b565b61111f60f11b604c9290910191820152731e3a32bc3a103c1e91189b11103c9e91189b111f60611b604e8201528351613f5a81606284016020880161350b565b7f3c2f746578743e3c2f613e3c6120687265663d2268747470733a2f2f6a756963910160628101919091527f65626f782e6d6f6e6579223e3c7465787420783d223235392e32352220793d22608282015263189b111f60e11b60a282015262ee808160e81b60a6820152613fe660a982016e1e17ba32bc3a1f1e17b09f1e17b39f60891b8152600f0190565b9695505050505050565b818103818111156112b4576112b4613858565b6000825161401581846020870161350b565b600160fd1b920191825250600101919050565b80516132e48161356e565b6000610120828403121561404657600080fd5b61404e613318565b825181526020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a082015260c083015160c082015261409a60e08401614028565b60e0820152610100928301519281019290925250919050565b600084516140c581846020890161350b565b80830190507f3c672066696c7465723d2275726c282366696c7465723129223e3c746578742081526c3c1e911811103c9e911a1c111f60991b6020820152845161411681602d84016020890161350b565b661e17ba32bc3a1f60c91b602d92909101918201819052721e3a32bc3a103c1e911811103c9e911b1a111f60691b60348301527f2020202020202020202020202020202020202020202020202020202020200000604783015260658201819052721e3a32bc3a103c1e911811103c9e911c18111f60691b606c83015284516141a581607f85016020890161350b565b607f92019182015260860195945050505050565b600087516141cb818460208c0161350b565b721e3a32bc3a103c1e911811103c9e911c9b111f60691b90830190815287516141fb816013840160208c0161350b565b661e17ba32bc3a1f60c91b601392909101918201819052731e3a32bc3a103c1e911811103c9e91189899111f60611b601a830152875161424281602e850160208c0161350b565b602e920191820152731e3a32bc3a103c1e911811103c9e9118991c111f60611b6035820152855161427a816049840160208a0161350b565b61010160f51b910160498101919091527f3c6120687265663d2268747470733a2f2f65746865727363616e2e696f2f6164604b8201526564726573732f60d01b606b8201526142fa6142ea6142e46142d6607185015b896135bd565b61111f60f11b815260020190565b866135bd565b631e17b09f60e11b815260040190565b9998505050505050505050565b60008551614319818460208a0161350b565b7f3c2f746578743e3c2f673e3c2f673e3c646566733e3c66696c7465722069643d9083019081527f2266696c746572312220783d222d332e33362220793d2232362e30342220776960208201527f6474683d2232393822206865696768743d22313530222066696c746572556e6960408201527f74733d227573657253706163654f6e5573652220636f6c6f722d696e7465727060608201527f6f6c6174696f6e2d66696c746572733d2273524742223e3c66654d6f7270686f60808201527f6c6f6779206f70657261746f723d2264696c61746522207261646975733d223060a08201527f2e312220696e3d22536f75726365416c7068612220726573756c743d2274686960c08201527f636b656e222f3e3c6665476175737369616e426c757220696e3d22746869636b60e08201527f656e2220737464446576696174696f6e3d22302e352220726573756c743d22626101008201527f6c7572726564222f3e3c6665466c6f6f6420666c6f6f642d636f6c6f723d2223610120820152611b1d6148956142e46147136142d06144b561014087018c6135bd565b7f2220726573756c743d22676c6f77436f6c6f72222f3e3c6665436f6d706f736981527f746520696e3d22676c6f77436f6c6f722220696e323d22626c7572726564222060208201527f6f70657261746f723d22696e2220726573756c743d22736f6674476c6f775f6360408201527f6f6c6f726564222f3e3c66654d657267653e3c66654d657267654e6f6465206960608201527f6e3d22736f6674476c6f775f636f6c6f726564222f3e3c66654d657267654e6f60808201527f646520696e3d22536f7572636547726170686963222f3e3c2f66654d6572676560a08201527f3e3c2f66696c7465723e3c66696c7465722069643d2266696c7465723222207860c08201527f3d22302220793d2230222077696474683d2232393822206865696768743d223160e08201527f3530222066696c746572556e6974733d227573657253706163654f6e557365226101008201527f20636f6c6f722d696e746572706f6c6174696f6e2d66696c746572733d2273526101208201527f4742223e3c66654d6f7270686f6c6f6779206f70657261746f723d2264696c616101408201527f746522207261646975733d22302e30352220696e3d22536f75726365416c70686101608201527f612220726573756c743d22746869636b656e222f3e3c6665476175737369616e6101808201527f426c757220696e3d22746869636b656e2220737464446576696174696f6e3d226101a08201527f302e32352220726573756c743d22626c7572726564222f3e3c6665466c6f6f646101c08201526e20666c6f6f642d636f6c6f723d222360881b6101e08201526101ef0190565b7f2220726573756c743d22676c6f77436f6c6f72222f3e3c6665436f6d706f736981527f746520696e3d22676c6f77436f6c6f722220696e323d22626c7572726564222060208201527f6f70657261746f723d22696e2220726573756c743d22736f6674476c6f775f6360408201527f6f6c6f726564222f3e3c66654d657267653e3c66654d657267654e6f6465206960608201527f6e3d22736f6674476c6f775f636f6c6f726564222f3e3c66654d657267654e6f60808201527f646520696e3d22536f7572636547726170686963222f3e3c2f66654d6572676560a08201527f3e3c2f66696c7465723e3c6c696e6561724772616469656e742069643d22706160c08201527f696e7430222078313d2230222079313d22323032222078323d2232383922207960e08201527f323d2232303222206772616469656e74556e6974733d227573657253706163656101008201527f4f6e557365223e3c73746f702073746f702d636f6c6f723d222300000000000061012082015261013a0190565b7f222f3e3c73746f70206f66667365743d22302e313139373932222073746f702d815267636f6c6f723d222360c01b602082015260280190565b600085516148e1818460208a0161350b565b8551908301906148f5818360208a0161350b565b8082019150507f222f3e3c73746f70206f66667365743d22302e383438393538222073746f702d815267636f6c6f723d222360c01b6020820152845161494281602884016020890161350b565b7f222f3e3c73746f70206f66667365743d2231222073746f702d636f6c6f723d2260289290910191820152602360f81b6048820152835161498a81604984016020880161350b565b7f222f3e3c2f6c696e6561724772616469656e743e3c636c697050617468206964604992909101918201527f3d22636c697030223e3c726563742077696474683d223238392220686569676860698201527f743d2231353022202f3e3c2f636c6970506174683e3c2f646566733e3c2f7376608982015261339f60f11b60a982015260ab019695505050505050565b808201808211156112b4576112b4613858565b80820281158282048414176112b4576112b4613858565b60208152815160208201526000602083015160408084015261224d606084018261352f565b60008251614a7a81846020870161350b565b61010160f51b920191825250600201919050565b60008251614aa081846020870161350b565b9190910192915050565b600181815b80851115614ae5578160001904821115614acb57614acb613858565b80851615614ad857918102915b93841c9390800290614aaf565b509250929050565b600082614afc575060016112b4565b81614b09575060006112b4565b8160018114614b1f5760028114614b2957614b45565b60019150506112b4565b60ff841115614b3a57614b3a613858565b50506001821b6112b4565b5060208310610133831016604e8410600b8410161715614b68575081810a6112b4565b614b728383614aaa565b8060001904821115614b8657614b86613858565b029392505050565b60006118708383614aed565b600060ff831680614bad57614bad613b48565b8060ff84160491505092915050565b60ff8181168382160290811690818114612ea257612ea2613858565b60ff82811682821603908111156112b4576112b4613858565b61060f60f31b815260008351614c0e81600285016020880161350b565b6271405360e91b6002918401918201528351614c3181600584016020880161350b565b01600501949350505050565b6b0101031e547b1e54ff0da43960a51b81528151600090614c6581600c85016020870161350b565b91909101600c0192915050565b62ee80b160e81b8152600160fd1b60038201528151600090614c9b81600485016020870161350b565b6920e1b485e1b480ca8f7360b01b6004939091019283015250600e01919050565b62ee80b160e81b8152600160fd1b60038201528151600090614ce581600485016020870161350b565b6720ca9c6f75ca807360c01b6004939091019283015250600c01919050565b62ee80b160e81b8152600160fd1b60038201528151600090614d2d81600485016020870161350b565b6f20e1b48dc9aac9b475e1b49be1b4877360801b6004939091019283015250601401919050565b62ee80b160e81b8152600160fd1b60038201528151600090614d7d81600485016020870161350b565b6c2073e1b487636fc9b4e1b4857360981b600493909101928301525060110191905056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa26469706673582212200c5414f520035620676e0ca24f20ff42b1098273c5821e2dae4e7f1c433908d264736f6c63430008110033

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

0000000000000000000000006f3c5afca0c9edf3926ef2ddf17c8ae6391afefb00000000000000000000000065572fb928b46f9adb7cfe5a4c41226f636161ea000000000000000000000000ffdd70c318915879d5192e8a0dcbfcb0285b3c9800000000000000000000000097a5b9d9f0f7cd676b69f584f29048d0ef4bb59b000000000000000000000000e3c01e9fd2a1dcc6edf0b1058b5757138ef9ffb6000000000000000000000000a77b7d93e79f1e6b4f77fab29d9ef85733a3d44a

-----Decoded View---------------
Arg [0] : _operatorStore (address): 0x6F3C5afCa0c9eDf3926eF2dDF17c8ae6391afEfb
Arg [1] : _directory (address): 0x65572FB928b46f9aDB7cfe5A4c41226F636161ea
Arg [2] : _controller (address): 0xFFdD70C318915879d5192e8a0dcbFcB0285b3C98
Arg [3] : _controller3_1 (address): 0x97a5b9D9F0F7cD676B69f584F29048D0Ef4BB59b
Arg [4] : _projectHandles (address): 0xE3c01E9Fd2a1dCC6edF0b1058B5757138EF9FfB6
Arg [5] : _capsulesTypeface (address): 0xA77b7D93E79f1E6B4f77FaB29d9ef85733A3D44A

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 0000000000000000000000006f3c5afca0c9edf3926ef2ddf17c8ae6391afefb
Arg [1] : 00000000000000000000000065572fb928b46f9adb7cfe5a4c41226f636161ea
Arg [2] : 000000000000000000000000ffdd70c318915879d5192e8a0dcbfcb0285b3c98
Arg [3] : 00000000000000000000000097a5b9d9f0f7cd676b69f584f29048d0ef4bb59b
Arg [4] : 000000000000000000000000e3c01e9fd2a1dcc6edf0b1058b5757138ef9ffb6
Arg [5] : 000000000000000000000000a77b7d93e79f1e6b4f77fab29d9ef85733a3d44a


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
[ 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.