HYPE Price: $22.66 (+2.35%)
 

Overview

HYPE Balance

HyperEVM LogoHyperEVM LogoHyperEVM Logo0 HYPE

HYPE Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To

There are no matching entries

1 Internal Transaction found.

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To
39170292025-05-16 21:59:00254 days ago1747432740  Contract Creation0 HYPE
Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Distributor

Compiler Version
v0.8.23+commit.f704f362

Optimization Enabled:
Yes with 200 runs

Other Settings:
shanghai EvmVersion
File 1 of 31 : Distributor.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.23;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

import {SignatureChecker} from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
import {MerkleProof} from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";

import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {
    AccessControlEnumerableUpgradeable
} from "@openzeppelin/contracts-upgradeable/access/extensions/AccessControlEnumerableUpgradeable.sol";
import {EIP712Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol";

import {ConfigChanged} from "echo/interfaces/PlatformEvents.sol";
import {Merkle} from "echo/Merkle.sol";
import {IGenericRegistry} from "echo/interfaces/IGenericRegistry.sol";
import {GenericRegistryKeys} from "echo/interfaces/GenericRegistryKeys.sol";
import "./Types.sol";
import {UnlockerLib} from "./UnlockerLib.sol";
import {Versioned} from "echo/Versioned.sol";

/// @title Distributor
contract Distributor is Initializable, AccessControlEnumerableUpgradeable, EIP712Upgradeable, Versioned(2, 0, 0) {
    using SafeERC20 for IERC20;
    using PriceLib for Price;

    /// @notice The role allowed to manage any funds related aspects of the contract
    /// @dev This is intended to be controlled by the IM team.
    bytes32 public constant MANAGER_ROLE = keccak256("MANAGER_ROLE");

    /// @notice The role allowed to grant ENG_MANAGER_ROLE
    /// @dev This is intended to be controlled by the ENG multisig.
    bytes32 public constant ENG_ADMIN_ROLE = keccak256("ENG_ADMIN_ROLE");

    /// @notice The role allowed to manage engineering related aspects of the contract, that does not involve any funds.
    /// @dev This is intended to be controlled by the ENG team.
    bytes32 public constant ENG_MANAGER_ROLE = keccak256("ENG_MANAGER_ROLE");

    /// @notice The role allowed to trigger a withdrawal of the platform carry.
    /// @dev This is intended to be controlled by the platform backend.
    bytes32 public constant PLATFORM_CARRY_WITHDRAWER_ROLE = keccak256("PLATFORM_CARRY_WITHDRAWER_ROLE");

    /// @notice The role allowed to prefill data for the platform carry.
    /// @dev This is intended to be controlled by the platform backend.
    bytes32 public constant PLATFORM_ROLE = keccak256("PLATFORM_ROLE");

    /// @notice The role allowed to sign claim data.
    /// @dev This is intended to be controlled by the platform backend.
    bytes32 public constant SIGNER_ROLE = keccak256("SIGNER_ROLE");

    /// @notice The role allowed to pause token claims and carry withdrawals.
    /// @dev This is intended to be controlled by the platform backend.
    /// @dev Keeping this deliberately separate from the `PLATFORM_CARRY_WITHDRAWER_ROLE` since we might want to grant this to some external monitoring in the future
    bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE");

    /// @notice The role allowed to prefill state data for the distributor.
    /// @dev A prefill is a one-time operation that sets the state of the distributor to some provided data before enabling any claims or withdrawals.
    /// This is required if we need to migrate a distribution to another chain and resume it there, e.g. because the project migrated.
    /// The intended process is:
    /// 1. The manager grants the PREFILL_ROLE to a platform operator (can be the backend or some manual operator).
    /// 2. The operator calls `prefillClaimerStates` with the desired data -- the data can be provided in chunks if needed.
    /// 3. The operator calls `addCarryWithdrawerStates` with the desired data -- the data can be provided in chunks if needed.
    /// 4. The operator calls `finalizePrefill` to mark the prefill as complete, which renounces the PREFILL_ROLE.
    bytes32 public constant PREFILL_ROLE = keccak256("PREFILL_ROLE");

    /// @dev The entity UUID for the platform. Note that the platform does **not** have actually have a UUID in our system.
    /// This is an implementation detail to ensure our carry calculation bookkeeping matches other carry receivers.
    bytes16 internal constant PLATFORM_ENTITY_UUID = bytes16(0);

    error InvalidConfiguration(string);
    error DuplicateUser(bytes16 entityUUID);
    error DuplicateCarryWithdrawer(bytes16 entityUUID);
    error CallerNotAllowed(address sender, bytes16 entityUUID, address signer);
    error UnauthorizedPlatformSigner(address signer);
    error UnauthorizedUserSigner(address got, address want);
    error UnknownUser();
    error ClaimExpired(uint256 expiredAt);
    error AmountExceedsClaimable(uint256 amount, uint256 claimableAmount);
    error AmountExceedsWithdrawableCarry(uint256 amount, uint256 withdrawableAmount);
    error WrongTokenDistribution(bytes16 got, bytes16 want);
    error UnexpectedClaimerMerkleRoot(bytes32[] leafs, bytes32 got, bytes32 want);
    error InvalidClaimerMerkleProof(bytes32 leaf, bytes32 got, bytes32 want);
    error Disabled();
    error InvalidClaimerState(bytes16 entityUUID);
    error ClaimerStateAlreadySet(bytes16 entityUUID);
    error WithdrawerStateAlreadySet(bytes16 entityUUID);
    error InvalidPrefillExpectedValue(string name, uint256 got, uint256 want);

    event Claimed(
        bytes16 indexed tokenDistributionUUID,
        bytes16 indexed entityUUID,
        address indexed receiver,
        uint256 amount,
        uint256 amountUSDC,
        uint256 amountCarry
    );

    event CarryWithdrawn(
        bytes16 indexed tokenDistributionUUID, bytes16 indexed entityUUID, address indexed receiver, uint256 amount
    );

    struct ClaimerState {
        uint256 amountClaimed;
        uint64 amountClaimedUSDC;
    }

    /// @dev Equivalent to CarryWithdrawer, but without the entity UUID since we will have it as key on the mapping.
    struct CarryWithdrawerWithoutUUID {
        address signer;
        uint16 carryBPS;
    }

    /// @notice The UnlockWallet provided by the project that gradually unlocks SPV assets.
    UnlockerLib.Unlocker public unlocker;

    /// @notice The GenericRegistry contract which stores the platform specific carry receiver.
    IGenericRegistry public genericRegistry;

    /// @notice  The token that will be unlocked/released.
    IERC20 public token;

    /// @notice Flag to enable/disable token claims and carry withdrawals.
    bool public isEnabled;

    /// @notice Flag to enable/disable the forced distribution mode.
    /// @dev When enabled, the token claim and carry withdrawal functions do not require signatures from the user signer.
    bool public isForcedDistributionModeEnabled;

    /// @notice The UUID of the token distribution.
    bytes16 public tokenDistributionUUID;

    /// @notice  The total amount of distribution shares for the SPV across all users.
    /// @dev This is the sum of all `distributionShares` in `usersSettings`.
    /// @dev It is used to compute the relative share of the total unlocked tokens for each state. It is derived from
    /// the users's ownership of the SPV.
    uint64 public totalDistributionShares;

    /// @notice The total carry in basis points.
    uint16 public totalCarryBPS;

    /// @notice The total amount of tokens claimed by users.
    uint256 public totalClaimed;

    /// @notice The total amount of carry that has been generated, i.e. deducted from user's claims.
    uint256 public totalCarryGenerated;

    /// @notice The total amount of carry withdrawn by carry receivers.
    uint256 public totalCarryWithdrawn;

    /// @notice The carry for the platform in basis points.
    uint16 public platformCarryBPS;

    /// @notice Tracks the amount of tokens each user has already claimed.
    mapping(bytes16 => ClaimerState) private _claimerState;

    /// @notice Tracks the amount of carry each carry withdrawer has withdrawn.
    /// @dev This also keeps track of the platform carry under the PLATFORM_ENTITY_UUID key.
    mapping(bytes16 => uint256) private _carryAmountWithdrawn;

    /// @notice The root of the claimers merkle tree.
    bytes32 public claimersRoot;

    /// @notice Tracks settings for carry withdrawers.
    /// @dev This does not include settings for the platform carry.
    mapping(bytes16 => CarryWithdrawerWithoutUUID) private _carryWithdrawers;

    /// @notice The UUIDs of the carry receivers.
    bytes16[] private _carryWithdrawerUUIDs;

    struct Init {
        IERC20 token;
        bytes16 tokenDistributionUUID;
        UnlockerLib.Unlocker unlocker;
        IGenericRegistry genericRegistry;
        Claimer[] claimers;
        CarryWithdrawer[] carryWithdrawers;
        address adminIM;
        address managerIM;
        address adminENG;
        address managerENG;
        address platformSigner;
        address platformSender;
        bytes32 expectedClaimersRoot;
        uint16 platformCarryBPS;
    }

    constructor() {
        _disableInitializers();
    }

    function initialize(Init memory init) external initializer {
        __AccessControlEnumerable_init();
        __EIP712_init("Distributor", "1");

        _setRoleAdmin(ENG_MANAGER_ROLE, ENG_ADMIN_ROLE);
        _setRoleAdmin(SIGNER_ROLE, ENG_MANAGER_ROLE);
        _setRoleAdmin(PLATFORM_CARRY_WITHDRAWER_ROLE, ENG_MANAGER_ROLE);

        // granting IM roles
        _grantRole(DEFAULT_ADMIN_ROLE, init.adminIM);
        _grantRole(MANAGER_ROLE, init.managerIM);

        // granting ENG roles
        _grantRole(ENG_ADMIN_ROLE, init.adminENG);
        _grantRole(ENG_MANAGER_ROLE, init.managerENG);

        // granting platform roles
        _grantRole(SIGNER_ROLE, init.platformSigner);
        _grantRole(PLATFORM_CARRY_WITHDRAWER_ROLE, init.platformSender);
        _grantRole(PLATFORM_ROLE, init.platformSender);
        _grantRole(PAUSER_ROLE, init.platformSender);

        UnlockerLib.validate(init.unlocker);
        unlocker = init.unlocker;
        genericRegistry = init.genericRegistry;
        token = init.token;
        tokenDistributionUUID = init.tokenDistributionUUID;
        platformCarryBPS = init.platformCarryBPS;

        _setClaimers(init.claimers, init.expectedClaimersRoot);
        _setCarryWithdrawerSettings(init.carryWithdrawers);
        isEnabled = true;
    }

    /// @notice Returns the domain separator for this contract.
    function domainSeparator() external view returns (bytes32) {
        return _domainSeparatorV4();
    }

    function claimerStates(bytes16[] calldata entityUUID) external view returns (ClaimerState[] memory) {
        ClaimerState[] memory ret = new ClaimerState[](entityUUID.length);
        for (uint256 i = 0; i < entityUUID.length; i++) {
            ret[i] = _claimerState[entityUUID[i]];
        }
        return ret;
    }

    function claimed(bytes16[] calldata entityUUID) external view returns (uint256[] memory) {
        uint256[] memory ret = new uint256[](entityUUID.length);
        for (uint256 i = 0; i < entityUUID.length; i++) {
            ret[i] = _claimerState[entityUUID[i]].amountClaimed;
        }
        return ret;
    }

    /// @notice Pulls the unlocked tokens from the unlock wallet.
    /// @dev This function can be called by anyone to pull the unlocked tokens from the unlock wallet at any point. However, we commonly expect
    /// it be called when a user claims their tokens.
    function pullUnlockedTokens() public {
        UnlockerLib.release(unlocker);
    }

    /// @notice Claims tokens for a given user. Requires valid signatures of the claim data (user + platform).
    /// @dev The function needs two valid signatures of the claim data (user + platform) to authorize a claim.
    /// There is no additional access control on the function, which allows anyone to execute a claim as long as the signatures are valid.
    /// We chose this approach as it gives us ultimate flexibility in who executes the transaction,
    /// e.g. it could either be send by the user on the frontend or by the platform backend.
    /// Does not require claimer signature if the contract has the`forcedDistributionModeEnabled` flag enabled.
    /// @param claimData The claim data that is signed by the user and the platform.
    /// @param claimSignatureUser The signature of the claim data by the user (EIP-712).
    /// @param claimSignaturePlatform The signature of the claim data by the platform (EIP-712).
    /// @param user The user settings that are used in the merkle proof.
    /// @param merkleProof The merkle proof that is used to verify the user's settings in the merkle tree.
    /// @param pullUnlocked Whether to pull the unlocked tokens from the unlocker contract.
    function claim(
        ClaimData calldata claimData,
        bytes calldata claimSignatureUser,
        bytes calldata claimSignaturePlatform,
        Claimer calldata user,
        bytes32[] calldata merkleProof,
        bool pullUnlocked
    ) external onlyIf(isEnabled) {
        if (pullUnlocked) {
            pullUnlockedTokens();
        }

        _release(claimData, claimSignatureUser, claimSignaturePlatform, user, merkleProof);
    }

    function _release(
        ClaimData calldata claimData,
        bytes calldata claimSignatureUser,
        bytes calldata claimSignaturePlatform,
        Claimer calldata user,
        bytes32[] calldata merkleProof
    ) internal {
        if (claimData.tokenDistributionUUID != tokenDistributionUUID) {
            revert WrongTokenDistribution(claimData.tokenDistributionUUID, tokenDistributionUUID);
        }

        if (block.timestamp >= claimData.expiresAt) {
            revert ClaimExpired(claimData.expiresAt);
        }

        {
            bytes32 leaf = Merkle.hashLeaf(abi.encode(user));
            bytes32 computedRoot = MerkleProof.processProofCalldata(merkleProof, leaf);
            if (computedRoot != claimersRoot) {
                revert InvalidClaimerMerkleProof(leaf, computedRoot, claimersRoot);
            }
        }

        {
            bytes32 digest = ClaimDataLib.digestTypedData(claimData, _domainSeparatorV4());

            if (
                !isForcedDistributionModeEnabled
                    && !SignatureChecker.isValidSignatureNow(user.signer, digest, claimSignatureUser)
            ) {
                address signer = ECDSA.recover(digest, claimSignatureUser);
                revert UnauthorizedUserSigner(signer, user.signer);
            }

            address signerPlatform = ECDSA.recover(digest, claimSignaturePlatform);
            if (!hasRole(SIGNER_ROLE, signerPlatform)) {
                revert UnauthorizedPlatformSigner(signerPlatform);
            }
        }

        ClaimerState storage state = _claimerState[claimData.entityUUID];

        {
            // we don't include the releasable amount here and only consider the actual amount received by the contract
            uint256 claimableAmount = _claimable(claimData.entityUUID, user.distributionShares, false);
            if (claimData.amount > claimableAmount) {
                revert AmountExceedsClaimable(claimData.amount, claimableAmount);
            }
        }

        uint256 amountUSDC = claimData.price.convertTokenToUSDC(claimData.amount);
        uint256 amountCarry = _calculateCarryAmount(
            claimData.entityUUID, user.amountInvestedUSDC, user.notChargedCarry, claimData.amount, claimData.price
        );

        state.amountClaimed += claimData.amount;
        state.amountClaimedUSDC += uint64(amountUSDC);

        totalClaimed += claimData.amount;
        totalCarryGenerated += amountCarry;

        emit Claimed(
            tokenDistributionUUID, claimData.entityUUID, claimData.receiver, claimData.amount, amountUSDC, amountCarry
        );

        token.safeTransfer(claimData.receiver, claimData.amount - amountCarry);
    }

    function _calculateCarryAmountUSDC(
        uint256 investedUSDC,
        uint256 claimedUSDC,
        uint256 amountToClaimUSDC,
        uint256 totalCarryBPS_
    ) internal pure returns (uint256) {
        uint256 remainingAmountFreeOfCarryUSDC = investedUSDC > claimedUSDC ? investedUSDC - claimedUSDC : 0;
        uint256 amountWithCarryUSDC =
            amountToClaimUSDC > remainingAmountFreeOfCarryUSDC ? amountToClaimUSDC - remainingAmountFreeOfCarryUSDC : 0;
        return Math.mulDiv(amountWithCarryUSDC, totalCarryBPS_, 10000);
    }

    /// @notice Helper function to compute the carry amount for a given claim.
    /// @dev The function does not verify that the amount can actually be claimed by the entity.
    function _calculateCarryAmount(
        bytes16 entityUUID,
        uint256 amountInvestedUSDC,
        bool notChargedCarry,
        uint256 amountToClaim,
        Price calldata price
    ) internal view returns (uint256) {
        if (notChargedCarry) {
            return 0;
        }

        uint256 amountUSDC = price.convertTokenToUSDC(amountToClaim);
        uint256 amountCarryUSDC = _calculateCarryAmountUSDC(
            amountInvestedUSDC, _claimerState[entityUUID].amountClaimedUSDC, amountUSDC, totalCarryBPS
        );
        uint256 amountCarry = price.convertUSDCToToken(amountCarryUSDC);

        return amountCarry;
    }

    /// @notice Withdraws the carry for a given carry receiver (e.g. a deal lead)
    /// @dev This function should only be used for entities and not for the platform. The platform should use the `withdrawCarryPlatform`
    /// The function needs two valid signatures of the claim data (user + platform) to authorize a claim.
    /// There is no additional access control on the function, which allows anyone to execute a claim as long as the signatures are valid.
    /// We chose this approach as it gives us ultimate flexibility in who executes the transaction,
    /// e.g. it could either be send by the user on the frontend or by the platform backend.
    /// Does not require claimer signature if the contract has the`forcedDistributionModeEnabled` flag enabled.
    /// @param data The data required to withdraw the carry
    /// @param userSignature The signature of the user using EIP-712
    /// @param platformSignature The signature of the platform using EIP-712
    function withdrawCarry(
        CarryWithdrawalData calldata data,
        bytes calldata userSignature,
        bytes calldata platformSignature
    ) external onlyIf(isEnabled) {
        if (data.tokenDistributionUUID != tokenDistributionUUID) {
            revert WrongTokenDistribution(data.tokenDistributionUUID, tokenDistributionUUID);
        }

        if (block.timestamp >= data.expiresAt) {
            revert ClaimExpired(data.expiresAt);
        }

        CarryWithdrawerWithoutUUID memory user = _carryWithdrawers[data.entityUUID];
        if (user.signer == address(0)) {
            revert UnknownUser();
        }

        {
            bytes32 digest = CarryWithdrawalLib.digestTypedData(data, _domainSeparatorV4());

            if (
                !isForcedDistributionModeEnabled
                    && !SignatureChecker.isValidSignatureNow(user.signer, digest, userSignature)
            ) {
                address signer = ECDSA.recover(digest, userSignature);
                revert UnauthorizedUserSigner(signer, user.signer);
            }

            address signerPlatform = ECDSA.recover(digest, platformSignature);
            if (!hasRole(SIGNER_ROLE, signerPlatform)) {
                revert UnauthorizedPlatformSigner(signerPlatform);
            }
        }

        {
            uint256 maxAmount = _carryWithdrawable(data.entityUUID, user.carryBPS);
            if (data.amount > maxAmount) {
                revert AmountExceedsWithdrawableCarry(data.amount, maxAmount);
            }
        }

        _carryAmountWithdrawn[data.entityUUID] += data.amount;
        totalCarryWithdrawn += data.amount;

        emit CarryWithdrawn(data.tokenDistributionUUID, data.entityUUID, data.receiver, data.amount);

        token.safeTransfer(data.receiver, data.amount);
    }

    /// @notice Withdraws the platform carry from the contract.
    /// @dev Carry receivers should use the `withdrawCarry` function.
    /// @param amount The amount of carry in tokens to withdraw
    function withdrawCarryPlatform(uint256 amount) external onlyRole(PLATFORM_CARRY_WITHDRAWER_ROLE) {
        address platformReceiver = genericRegistry.readAddress(GenericRegistryKeys.PLATFORM_CARRY_RECEIVER);
        uint256 maxAmount = _carryWithdrawable(PLATFORM_ENTITY_UUID, platformCarryBPS);
        if (amount > maxAmount) {
            revert AmountExceedsWithdrawableCarry(amount, maxAmount);
        }

        _carryAmountWithdrawn[PLATFORM_ENTITY_UUID] += amount;
        totalCarryWithdrawn += amount;

        emit CarryWithdrawn(tokenDistributionUUID, PLATFORM_ENTITY_UUID, platformReceiver, amount);

        token.safeTransfer(platformReceiver, amount);
    }

    function _carryWithdrawable(bytes16 entityUUID, uint16 carryBPS) internal view returns (uint256) {
        return Math.mulDiv(totalCarryGenerated, carryBPS, totalCarryBPS) - _carryAmountWithdrawn[entityUUID];
    }

    /// @notice Computes the withdrawable carry amount for the platform.
    /// @return The carry withdrawable amount of tokens for the platform.
    function carryWithdrawablePlatform() external view returns (uint256) {
        return _carryWithdrawable(PLATFORM_ENTITY_UUID, platformCarryBPS);
    }

    /// @notice Returns the amount of tokens that have been withdrawn from the carry pool for the platform.
    /// @return The amount of tokens that have been withdrawn from the carry pool for the platform.
    function carryWithdrawnPlatform() external view returns (uint256) {
        return _carryAmountWithdrawn[PLATFORM_ENTITY_UUID];
    }

    /// @notice Computes the carry withdrawable amount for a list of entities.
    /// @dev Not used to calculate the carry withdrawn for the platform as this is handled separately by the platform specific function
    /// `carryWithdrawblePlatform`.
    /// @param entityUUIDs The UUIDs of the entities.
    /// @return The carry withdrawable amount of tokens for each entity.
    function carryWithdrawable(bytes16[] calldata entityUUIDs) external view returns (uint256[] memory) {
        uint256[] memory ret = new uint256[](entityUUIDs.length);
        for (uint256 i = 0; i < entityUUIDs.length; i++) {
            ret[i] = _carryWithdrawable(entityUUIDs[i], _carryWithdrawers[entityUUIDs[i]].carryBPS);
        }
        return ret;
    }

    /// @notice Returns the amount of tokens that have been withdrawn from the carry pool for each entity.
    /// @dev Not used to calculate the carry withdrawn for the platform as this is handled separately by the platform specific function
    /// `carryWithdrawnPlatform`.
    /// @param entityUUIDs The UUIDs of the entities.
    /// @return The amount of tokens that have been withdrawn from the carry pool for each entity.
    function carryWithdrawn(bytes16[] calldata entityUUIDs) external view returns (uint256[] memory) {
        uint256[] memory ret = new uint256[](entityUUIDs.length);
        for (uint256 i = 0; i < entityUUIDs.length; i++) {
            ret[i] = _carryAmountWithdrawn[entityUUIDs[i]];
        }
        return ret;
    }

    function _claimable(
        bytes16 entityUUID,
        uint64 distributionShares,
        bool includeReleasable
    ) internal view returns (uint256) {
        // we're using the current balance here instead of keeping track of the amount that was pulled in from the unlock wallet
        // to account for any tokens that were manually sent to the distributor contract

        // the total received amount is computed as the current balance + everything that left the contract
        uint256 totalReceived =
            token.balanceOf(address(this)) + (totalClaimed - totalCarryGenerated) + totalCarryWithdrawn;

        if (includeReleasable) {
            totalReceived += UnlockerLib.releasable(unlocker);
        }

        uint256 unlockedForUser = Math.mulDiv(totalReceived, distributionShares, totalDistributionShares);
        uint256 alreadyClaimed = _claimerState[entityUUID].amountClaimed;

        // We have a bounds check in case there is a discrepancy between what has been prefilled for the claim data
        // and what the user can now claim. This can happen if there was an incorrect amount of tokens that were initially
        // claimed by the user, and we have updated what the user can now claim.
        if (unlockedForUser < alreadyClaimed) {
            return 0;
        }

        return unlockedForUser - alreadyClaimed;
    }

    /// @notice Computes the claimable amount of tokens for a list of users.
    /// @dev The correctness of the response depends on the correctness of the input parameters,
    /// i.e. whether the user UUIDs and invested amounts are included in the settings as encoded in the corresponding merkle root.
    /// The validity of the passed parameters is NOT validated against the stored merkle root.
    /// @param entityUUIDs The UUIDs of the users.
    /// @param distributionShares The amount of SPV shares for each user.
    /// @param includeReleasable Whether to include the amount releasable from the unlocker in the computation.
    function claimable(
        bytes16[] calldata entityUUIDs,
        uint64[] calldata distributionShares,
        bool includeReleasable
    ) external view returns (uint256[] memory) {
        uint256[] memory ret = new uint256[](entityUUIDs.length);
        for (uint256 i = 0; i < entityUUIDs.length; i++) {
            ret[i] = _claimable(entityUUIDs[i], distributionShares[i], includeReleasable);
        }
        return ret;
    }

    struct CalculateCarryAmountClaimParameters {
        bytes16 entityUUID;
        uint64 amountInvestedUSDC;
        bool notChargedCarry;
        uint256 amountToClaim;
    }

    /// @notice Computes the carry amounts for a list of claims.
    /// @dev This function is intended to be used offchain to compute the carry amounts for a list of claims.
    /// @dev The correctness of the response depends on the correctness of the input parameters,
    /// i.e. whether the entity UUIDs and investment amounts are included in the settings as encoded in the corresponding merkle root.
    /// The validity of the passed parameters is NOT validated against the stored merkle root.
    /// @dev The function does not verify that the amounts can actually be claimed by the entities.
    function calculateCarryAmountForClaims(
        CalculateCarryAmountClaimParameters[] calldata claimParams,
        Price calldata price
    ) external view returns (uint256[] memory) {
        uint256[] memory carryAmounts = new uint256[](claimParams.length);
        for (uint256 i = 0; i < claimParams.length; i++) {
            carryAmounts[i] = _calculateCarryAmount(
                claimParams[i].entityUUID,
                claimParams[i].amountInvestedUSDC,
                claimParams[i].notChargedCarry,
                claimParams[i].amountToClaim,
                price
            );
        }

        return carryAmounts;
    }

    /// @notice Setter for the generic registry.
    function setGenericRegistry(IGenericRegistry registry) external onlyRole(MANAGER_ROLE) {
        genericRegistry = registry;
    }

    /// @notice Setter for the platform carry BPS
    /// @dev We use a separate setter for the platform carry over setting it in the setCarryWithdrawerSettings
    /// as the platform is separate from a carry receiver.
    /// @param bps The platform's carry in basis points.
    function setPlatformCarryBPS(uint16 bps) external onlyRole(MANAGER_ROLE) {
        if (bps > 2000) {
            revert InvalidConfiguration("Platform carry BPS cannot be greater than 20%");
        }

        totalCarryBPS = totalCarryBPS - platformCarryBPS + bps;
        platformCarryBPS = bps;
    }

    /// @notice Updates the claimers of the distributor.
    /// @dev The function must be used with UTMOST CAUTION since it can change the user's and total amount invested, which will interfere with the claimable amount computation.
    /// @param claimers The claimer settings to update.
    /// @param expectedRoot The expected root of the user settings merkle tree.
    function setClaimers(Claimer[] calldata claimers, bytes32 expectedRoot) external onlyRole(MANAGER_ROLE) {
        _setClaimers(claimers, expectedRoot);
        // TODO add ConfigChanged event
    }

    /// @notice Internal function to set the user settings.
    /// @dev The merkle tree root of the settings is computed and compared against the expected root.
    /// This is intended as a sanity check to make sure we can correctly compute the merkle tree root on the backend.
    function _setClaimers(Claimer[] memory claimers, bytes32 expectedRoot) internal {
        uint64 totalDistributionShares_ = 0;
        bytes32[] memory claimerLeaves = new bytes32[](claimers.length);
        for (uint256 i = 0; i < claimers.length; i++) {
            Claimer memory s = claimers[i];

            if (s.entityUUID == PLATFORM_ENTITY_UUID) {
                revert InvalidConfiguration("entityUUID cannot be the platform entityUUID");
            }

            if (s.signer == address(0)) {
                revert InvalidConfiguration("signer is zero");
            }

            if (s.amountInvestedUSDC == 0) {
                revert InvalidConfiguration("amount invested is zero");
            }

            if (s.distributionShares == 0) {
                revert InvalidConfiguration("distributionShares is zero");
            }

            // TODO check dupes somehow?

            totalDistributionShares_ += s.distributionShares;
            claimerLeaves[i] = Merkle.hashLeaf(abi.encode(s));
            // TODO add some guard rails (input expected totals), sanity checks, etc
        }
        totalDistributionShares = totalDistributionShares_;

        bytes32 computedRoot = Merkle.computeRootInPlace(claimerLeaves);
        if (computedRoot != expectedRoot) {
            revert UnexpectedClaimerMerkleRoot(claimerLeaves, computedRoot, expectedRoot);
        }
        claimersRoot = computedRoot;
    }

    /// @notice Updates the carry withdrawer settings.
    /// @dev This function must be used with UTMOST CAUTION since it can change the carry withdrawable amount, which will interfere with the carryWithdrawable computation.
    /// @param settings The carry withdrawer settings to update.
    function setCarryWithdrawerSettings(CarryWithdrawer[] calldata settings) external onlyRole(MANAGER_ROLE) {
        _setCarryWithdrawerSettings(settings);
        // TODO add ConfigChanged event?
    }

    /// @notice Internal function to set the carry withdrawer settings.
    /// @dev The merkle tree root of the settings is computed and compared against the expected root.
    /// This is intended as a sanity check to make sure we can correctly compute the merkle tree root on the backend.
    function _setCarryWithdrawerSettings(CarryWithdrawer[] memory settings) internal {
        // clearing the existing carry receivers first
        uint256 numExisting = _carryWithdrawerUUIDs.length;
        if (numExisting > 0) {
            for (uint256 i = 0; i < numExisting; i++) {
                delete _carryWithdrawers[_carryWithdrawerUUIDs[i]];
            }
            delete _carryWithdrawerUUIDs;
        }

        uint16 totalCarryBPS_ = 0;
        for (uint256 i = 0; i < settings.length; i++) {
            CarryWithdrawer memory s = settings[i];

            if (s.entityUUID == PLATFORM_ENTITY_UUID) {
                revert InvalidConfiguration("entityUUID cannot be the platform entityUUID");
            }

            if (s.signer == address(0)) {
                revert InvalidConfiguration("signer is zero");
            }

            if (s.carryBPS == 0) {
                revert InvalidConfiguration("carry BPS is zero");
            }

            if (_carryWithdrawers[s.entityUUID].signer != address(0)) {
                revert InvalidConfiguration("entityUUID already exists");
            }

            totalCarryBPS_ += s.carryBPS;
            _carryWithdrawerUUIDs.push(s.entityUUID);
            _carryWithdrawers[s.entityUUID] = CarryWithdrawerWithoutUUID({signer: s.signer, carryBPS: s.carryBPS});
            // TODO add some guard rails (input expected totals), sanity checks, etc
        }
        totalCarryBPS = totalCarryBPS_ + platformCarryBPS;
    }

    function setUnlocker(UnlockerLib.Unlocker calldata unlocker_) external onlyRole(ENG_MANAGER_ROLE) {
        UnlockerLib.validate(unlocker_);
        unlocker = unlocker_;
        emit ConfigChanged(this.setUnlocker.selector, "setUnlocker((address,bytes6,bytes6))", abi.encode(unlocker_));
    }

    function setForcedDistributionModeEnabled(bool enabled) external onlyRole(MANAGER_ROLE) {
        isForcedDistributionModeEnabled = enabled;
    }

    /// @notice Allows the manager to recover any tokens sent to the contract.
    /// @dev This is intended as a safeguard and should only be used in emergencies and with utmost care.
    function recoverTokens(IERC20 coin, address to, uint256 amount) external onlyRole(MANAGER_ROLE) {
        coin.safeTransfer(to, amount);
    }

    function carryWithdrawerUUIDs() external view returns (bytes16[] memory) {
        return _carryWithdrawerUUIDs;
    }

    function carryWithdrawer(bytes16[] calldata entityUUIDs)
        external
        view
        returns (CarryWithdrawerWithoutUUID[] memory)
    {
        CarryWithdrawerWithoutUUID[] memory ret = new CarryWithdrawerWithoutUUID[](entityUUIDs.length);
        for (uint256 i = 0; i < entityUUIDs.length; i++) {
            ret[i] = _carryWithdrawers[entityUUIDs[i]];
        }
        return ret;
    }

    /// @notice Sets whether token claims and carry withdrawals are enabled.
    function _setEnabled(bool isEnabled_) internal {
        isEnabled = isEnabled_;
        emit ConfigChanged(this.setEnabled.selector, "setEnabled(bool)", abi.encode(isEnabled_));
    }

    /// @notice Sets whether the deal funding is enabled.
    function setEnabled(bool isEnabled_) external onlyRole(ENG_MANAGER_ROLE) {
        _setEnabled(isEnabled_);
    }

    /// @notice Pauses the deal funding.
    /// @dev Equivalent to `setEnabled(false)`.
    function pause() external onlyRole(PAUSER_ROLE) {
        _setEnabled(false);
    }

    /// @notice Ensures that a function can only be called if a given flag is true.
    modifier onlyIf(bool flag) {
        if (!flag) {
            revert Disabled();
        }
        _;
    }

    /// @notice The state data for a claimer.
    /// @dev This is used to prefill the distributor with the claimer data from another distributor contract, usually due to the migration from another chain.
    struct PrefillDataClaimerState {
        bytes16 entityUUID;
        ClaimerState state;
    }

    /// @notice Sets the state of claimers in the distributor to the provided data.
    /// @dev This function can be called multiple times in case the prefill needs to be batched due to gas constraints.
    /// @dev Reverts if the state for an entity is already set, which is the case if we pass in the same entity multiple times.
    function prefillClaimerStates(PrefillDataClaimerState[] calldata states) external onlyRole(PREFILL_ROLE) {
        uint256 totalClaimed_ = totalClaimed;
        for (uint256 i = 0; i < states.length; i++) {
            bytes16 entityUUID = states[i].entityUUID;
            ClaimerState calldata state = states[i].state;

            // sanity check that both fields are either both zero or both non-zero
            // we never expect a user to have claimed tokens with zero price
            if ((state.amountClaimed > 0) != (state.amountClaimedUSDC > 0)) {
                revert InvalidClaimerState(entityUUID);
            }

            if (_claimerState[entityUUID].amountClaimed > 0) {
                revert ClaimerStateAlreadySet(entityUUID);
            }

            _claimerState[entityUUID] = state;
            totalClaimed_ += state.amountClaimed;
        }

        totalClaimed = totalClaimed_;
    }

    /// @notice The state data for a carry withdrawer.
    /// @dev This is used to prefill the distributor with the carry withdrawer data from another distributor contract, usually due to the migration from another chain.
    struct PrefillDataWithdrawerState {
        bytes16 entityUUID;
        uint256 amountCarryWithdrawn;
    }

    /// @notice Sets the state of withdrawers in the distributor to the provided data.
    /// @dev This function can be called multiple times in case the prefill needs to be batched due to gas constraints.
    /// @dev Reverts if the state for an entity is already set, which can be the case if we pass in the same entity multiple times.
    function prefillWithdrawerStates(PrefillDataWithdrawerState[] calldata states) external onlyRole(PREFILL_ROLE) {
        uint256 totalCarryWithdrawn_ = totalCarryWithdrawn;
        for (uint256 i = 0; i < states.length; i++) {
            bytes16 entityUUID = states[i].entityUUID;
            if (_carryAmountWithdrawn[entityUUID] > 0) {
                revert WithdrawerStateAlreadySet(entityUUID);
            }

            _carryAmountWithdrawn[entityUUID] = states[i].amountCarryWithdrawn;
            totalCarryWithdrawn_ += states[i].amountCarryWithdrawn;
        }

        totalCarryWithdrawn = totalCarryWithdrawn_;
    }

    /// @notice Finalizes the prefill by setting the totalCarryGenerated and checking expected sums from the prefill data.
    /// @dev The caller renounces the PREFILL_ROLE in this function call, marking the prefill as complete.
    function finalizePrefill(
        uint256 totalCarryGenerated_,
        uint256 expectedTotalClaimed_,
        uint256 expectedTotalCarryWithdrawn_
    ) external onlyRole(PREFILL_ROLE) {
        // we can unfortunately not compute this from other prefilled data, so we pass it in here and set it.
        totalCarryGenerated = totalCarryGenerated_;

        // additional sanity checks that the prefill went as expected
        if (totalClaimed != expectedTotalClaimed_) {
            revert InvalidPrefillExpectedValue("totalClaimed", totalClaimed, expectedTotalClaimed_);
        }

        if (totalCarryWithdrawn != expectedTotalCarryWithdrawn_) {
            revert InvalidPrefillExpectedValue("totalCarryWithdrawn", totalCarryWithdrawn, expectedTotalCarryWithdrawn_);
        }

        renounceRole(PREFILL_ROLE, msg.sender);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the value of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 value) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    /**
     * @dev An operation with an ERC20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data);
        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/SignatureChecker.sol)

pragma solidity ^0.8.20;

import {ECDSA} from "./ECDSA.sol";
import {IERC1271} from "../../interfaces/IERC1271.sol";

/**
 * @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA
 * signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like
 * Argent and Safe Wallet (previously Gnosis Safe).
 */
library SignatureChecker {
    /**
     * @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the
     * signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`.
     *
     * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
     * change through time. It could return true at block N and false at block N+1 (or the opposite).
     */
    function isValidSignatureNow(address signer, bytes32 hash, bytes memory signature) internal view returns (bool) {
        (address recovered, ECDSA.RecoverError error, ) = ECDSA.tryRecover(hash, signature);
        return
            (error == ECDSA.RecoverError.NoError && recovered == signer) ||
            isValidERC1271SignatureNow(signer, hash, signature);
    }

    /**
     * @dev Checks if a signature is valid for a given signer and data hash. The signature is validated
     * against the signer smart contract using ERC1271.
     *
     * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus
     * change through time. It could return true at block N and false at block N+1 (or the opposite).
     */
    function isValidERC1271SignatureNow(
        address signer,
        bytes32 hash,
        bytes memory signature
    ) internal view returns (bool) {
        (bool success, bytes memory result) = signer.staticcall(
            abi.encodeCall(IERC1271.isValidSignature, (hash, signature))
        );
        return (success &&
            result.length >= 32 &&
            abi.decode(result, (bytes32)) == bytes32(IERC1271.isValidSignature.selector));
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MerkleProof.sol)

pragma solidity ^0.8.20;

/**
 * @dev These functions deal with verification of Merkle Tree proofs.
 *
 * The tree and the proofs can be generated using our
 * https://github.com/OpenZeppelin/merkle-tree[JavaScript library].
 * You will find a quickstart guide in the readme.
 *
 * WARNING: You should avoid using leaf values that are 64 bytes long prior to
 * hashing, or use a hash function other than keccak256 for hashing leaves.
 * This is because the concatenation of a sorted pair of internal nodes in
 * the Merkle tree could be reinterpreted as a leaf value.
 * OpenZeppelin's JavaScript library generates Merkle trees that are safe
 * against this attack out of the box.
 */
library MerkleProof {
    /**
     *@dev The multiproof provided is not valid.
     */
    error MerkleProofInvalidMultiproof();

    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     */
    function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
        return processProof(proof, leaf) == root;
    }

    /**
     * @dev Calldata version of {verify}
     */
    function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
        return processProofCalldata(proof, leaf) == root;
    }

    /**
     * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up
     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
     * hash matches the root of the tree. When processing the proof, the pairs
     * of leafs & pre-images are assumed to be sorted.
     */
    function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            computedHash = _hashPair(computedHash, proof[i]);
        }
        return computedHash;
    }

    /**
     * @dev Calldata version of {processProof}
     */
    function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            computedHash = _hashPair(computedHash, proof[i]);
        }
        return computedHash;
    }

    /**
     * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by
     * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}.
     *
     * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
     */
    function multiProofVerify(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32 root,
        bytes32[] memory leaves
    ) internal pure returns (bool) {
        return processMultiProof(proof, proofFlags, leaves) == root;
    }

    /**
     * @dev Calldata version of {multiProofVerify}
     *
     * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
     */
    function multiProofVerifyCalldata(
        bytes32[] calldata proof,
        bool[] calldata proofFlags,
        bytes32 root,
        bytes32[] memory leaves
    ) internal pure returns (bool) {
        return processMultiProofCalldata(proof, proofFlags, leaves) == root;
    }

    /**
     * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction
     * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another
     * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false
     * respectively.
     *
     * CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree
     * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the
     * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).
     */
    function processMultiProof(
        bytes32[] memory proof,
        bool[] memory proofFlags,
        bytes32[] memory leaves
    ) internal pure returns (bytes32 merkleRoot) {
        // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
        // the Merkle tree.
        uint256 leavesLen = leaves.length;
        uint256 proofLen = proof.length;
        uint256 totalHashes = proofFlags.length;

        // Check proof validity.
        if (leavesLen + proofLen != totalHashes + 1) {
            revert MerkleProofInvalidMultiproof();
        }

        // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
        // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
        bytes32[] memory hashes = new bytes32[](totalHashes);
        uint256 leafPos = 0;
        uint256 hashPos = 0;
        uint256 proofPos = 0;
        // At each step, we compute the next hash using two values:
        // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
        //   get the next hash.
        // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
        //   `proof` array.
        for (uint256 i = 0; i < totalHashes; i++) {
            bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
            bytes32 b = proofFlags[i]
                ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
                : proof[proofPos++];
            hashes[i] = _hashPair(a, b);
        }

        if (totalHashes > 0) {
            if (proofPos != proofLen) {
                revert MerkleProofInvalidMultiproof();
            }
            unchecked {
                return hashes[totalHashes - 1];
            }
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

    /**
     * @dev Calldata version of {processMultiProof}.
     *
     * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details.
     */
    function processMultiProofCalldata(
        bytes32[] calldata proof,
        bool[] calldata proofFlags,
        bytes32[] memory leaves
    ) internal pure returns (bytes32 merkleRoot) {
        // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by
        // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the
        // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of
        // the Merkle tree.
        uint256 leavesLen = leaves.length;
        uint256 proofLen = proof.length;
        uint256 totalHashes = proofFlags.length;

        // Check proof validity.
        if (leavesLen + proofLen != totalHashes + 1) {
            revert MerkleProofInvalidMultiproof();
        }

        // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using
        // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop".
        bytes32[] memory hashes = new bytes32[](totalHashes);
        uint256 leafPos = 0;
        uint256 hashPos = 0;
        uint256 proofPos = 0;
        // At each step, we compute the next hash using two values:
        // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we
        //   get the next hash.
        // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the
        //   `proof` array.
        for (uint256 i = 0; i < totalHashes; i++) {
            bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++];
            bytes32 b = proofFlags[i]
                ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++])
                : proof[proofPos++];
            hashes[i] = _hashPair(a, b);
        }

        if (totalHashes > 0) {
            if (proofPos != proofLen) {
                revert MerkleProofInvalidMultiproof();
            }
            unchecked {
                return hashes[totalHashes - 1];
            }
        } else if (leavesLen > 0) {
            return leaves[0];
        } else {
            return proof[0];
        }
    }

    /**
     * @dev Sorts the pair (a, b) and hashes the result.
     */
    function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) {
        return a < b ? _efficientHash(a, b) : _efficientHash(b, a);
    }

    /**
     * @dev Implementation of keccak256(abi.encode(a, b)) that doesn't allocate or expand memory.
     */
    function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, a)
            mstore(0x20, b)
            value := keccak256(0x00, 0x40)
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.20;

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```solidity
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 *
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Storage of the initializable contract.
     *
     * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
     * when using with upgradeable contracts.
     *
     * @custom:storage-location erc7201:openzeppelin.storage.Initializable
     */
    struct InitializableStorage {
        /**
         * @dev Indicates that the contract has been initialized.
         */
        uint64 _initialized;
        /**
         * @dev Indicates that the contract is in the process of being initialized.
         */
        bool _initializing;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;

    /**
     * @dev The contract is already initialized.
     */
    error InvalidInitialization();

    /**
     * @dev The contract is not initializing.
     */
    error NotInitializing();

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint64 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
     * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
     * production.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        // Cache values to avoid duplicated sloads
        bool isTopLevelCall = !$._initializing;
        uint64 initialized = $._initialized;

        // Allowed calls:
        // - initialSetup: the contract is not in the initializing state and no previous version was
        //                 initialized
        // - construction: the contract is initialized at version 1 (no reininitialization) and the
        //                 current contract is just being deployed
        bool initialSetup = initialized == 0 && isTopLevelCall;
        bool construction = initialized == 1 && address(this).code.length == 0;

        if (!initialSetup && !construction) {
            revert InvalidInitialization();
        }
        $._initialized = 1;
        if (isTopLevelCall) {
            $._initializing = true;
        }
        _;
        if (isTopLevelCall) {
            $._initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint64 version) {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing || $._initialized >= version) {
            revert InvalidInitialization();
        }
        $._initialized = version;
        $._initializing = true;
        _;
        $._initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        _checkInitializing();
        _;
    }

    /**
     * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
     */
    function _checkInitializing() internal view virtual {
        if (!_isInitializing()) {
            revert NotInitializing();
        }
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing) {
            revert InvalidInitialization();
        }
        if ($._initialized != type(uint64).max) {
            $._initialized = type(uint64).max;
            emit Initialized(type(uint64).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint64) {
        return _getInitializableStorage()._initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _getInitializableStorage()._initializing;
    }

    /**
     * @dev Returns a pointer to the storage namespace.
     */
    // solhint-disable-next-line var-name-mixedcase
    function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
        assembly {
            $.slot := INITIALIZABLE_STORAGE
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/AccessControlEnumerable.sol)

pragma solidity ^0.8.20;

import {IAccessControlEnumerable} from "@openzeppelin/contracts/access/extensions/IAccessControlEnumerable.sol";
import {AccessControlUpgradeable} from "../AccessControlUpgradeable.sol";
import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import {Initializable} from "../../proxy/utils/Initializable.sol";

/**
 * @dev Extension of {AccessControl} that allows enumerating the members of each role.
 */
abstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerable, AccessControlUpgradeable {
    using EnumerableSet for EnumerableSet.AddressSet;

    /// @custom:storage-location erc7201:openzeppelin.storage.AccessControlEnumerable
    struct AccessControlEnumerableStorage {
        mapping(bytes32 role => EnumerableSet.AddressSet) _roleMembers;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.AccessControlEnumerable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant AccessControlEnumerableStorageLocation = 0xc1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e82371705932000;

    function _getAccessControlEnumerableStorage() private pure returns (AccessControlEnumerableStorage storage $) {
        assembly {
            $.slot := AccessControlEnumerableStorageLocation
        }
    }

    function __AccessControlEnumerable_init() internal onlyInitializing {
    }

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

    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) public view virtual returns (address) {
        AccessControlEnumerableStorage storage $ = _getAccessControlEnumerableStorage();
        return $._roleMembers[role].at(index);
    }

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) public view virtual returns (uint256) {
        AccessControlEnumerableStorage storage $ = _getAccessControlEnumerableStorage();
        return $._roleMembers[role].length();
    }

    /**
     * @dev Overload {AccessControl-_grantRole} to track enumerable memberships
     */
    function _grantRole(bytes32 role, address account) internal virtual override returns (bool) {
        AccessControlEnumerableStorage storage $ = _getAccessControlEnumerableStorage();
        bool granted = super._grantRole(role, account);
        if (granted) {
            $._roleMembers[role].add(account);
        }
        return granted;
    }

    /**
     * @dev Overload {AccessControl-_revokeRole} to track enumerable memberships
     */
    function _revokeRole(bytes32 role, address account) internal virtual override returns (bool) {
        AccessControlEnumerableStorage storage $ = _getAccessControlEnumerableStorage();
        bool revoked = super._revokeRole(role, account);
        if (revoked) {
            $._roleMembers[role].remove(account);
        }
        return revoked;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/EIP712.sol)

pragma solidity ^0.8.20;

import {MessageHashUtils} from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol";
import {IERC5267} from "@openzeppelin/contracts/interfaces/IERC5267.sol";
import {Initializable} from "../../proxy/utils/Initializable.sol";

/**
 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
 *
 * The encoding scheme specified in the EIP requires a domain separator and a hash of the typed structured data, whose
 * encoding is very generic and therefore its implementation in Solidity is not feasible, thus this contract
 * does not implement the encoding itself. Protocols need to implement the type-specific encoding they need in order to
 * produce the hash of their typed data using a combination of `abi.encode` and `keccak256`.
 *
 * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
 * ({_hashTypedDataV4}).
 *
 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
 * the chain id to protect against replay attacks on an eventual fork of the chain.
 *
 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
 *
 * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain
 * separator of the implementation contract. This will cause the {_domainSeparatorV4} function to always rebuild the
 * separator from the immutable values, which is cheaper than accessing a cached version in cold storage.
 */
abstract contract EIP712Upgradeable is Initializable, IERC5267 {
    bytes32 private constant TYPE_HASH =
        keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)");

    /// @custom:storage-location erc7201:openzeppelin.storage.EIP712
    struct EIP712Storage {
        /// @custom:oz-renamed-from _HASHED_NAME
        bytes32 _hashedName;
        /// @custom:oz-renamed-from _HASHED_VERSION
        bytes32 _hashedVersion;

        string _name;
        string _version;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.EIP712")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant EIP712StorageLocation = 0xa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d100;

    function _getEIP712Storage() private pure returns (EIP712Storage storage $) {
        assembly {
            $.slot := EIP712StorageLocation
        }
    }

    /**
     * @dev Initializes the domain separator and parameter caches.
     *
     * The meaning of `name` and `version` is specified in
     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
     *
     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
     * - `version`: the current major version of the signing domain.
     *
     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
     * contract upgrade].
     */
    function __EIP712_init(string memory name, string memory version) internal onlyInitializing {
        __EIP712_init_unchained(name, version);
    }

    function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {
        EIP712Storage storage $ = _getEIP712Storage();
        $._name = name;
        $._version = version;

        // Reset prior values in storage if upgrading
        $._hashedName = 0;
        $._hashedVersion = 0;
    }

    /**
     * @dev Returns the domain separator for the current chain.
     */
    function _domainSeparatorV4() internal view returns (bytes32) {
        return _buildDomainSeparator();
    }

    function _buildDomainSeparator() private view returns (bytes32) {
        return keccak256(abi.encode(TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash(), block.chainid, address(this)));
    }

    /**
     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
     * function returns the hash of the fully encoded EIP712 message for this domain.
     *
     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
     *
     * ```solidity
     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
     *     keccak256("Mail(address to,string contents)"),
     *     mailTo,
     *     keccak256(bytes(mailContents))
     * )));
     * address signer = ECDSA.recover(digest, signature);
     * ```
     */
    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
        return MessageHashUtils.toTypedDataHash(_domainSeparatorV4(), structHash);
    }

    /**
     * @dev See {IERC-5267}.
     */
    function eip712Domain()
        public
        view
        virtual
        returns (
            bytes1 fields,
            string memory name,
            string memory version,
            uint256 chainId,
            address verifyingContract,
            bytes32 salt,
            uint256[] memory extensions
        )
    {
        EIP712Storage storage $ = _getEIP712Storage();
        // If the hashed name and version in storage are non-zero, the contract hasn't been properly initialized
        // and the EIP712 domain is not reliable, as it will be missing name and version.
        require($._hashedName == 0 && $._hashedVersion == 0, "EIP712: Uninitialized");

        return (
            hex"0f", // 01111
            _EIP712Name(),
            _EIP712Version(),
            block.chainid,
            address(this),
            bytes32(0),
            new uint256[](0)
        );
    }

    /**
     * @dev The name parameter for the EIP712 domain.
     *
     * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs
     * are a concern.
     */
    function _EIP712Name() internal view virtual returns (string memory) {
        EIP712Storage storage $ = _getEIP712Storage();
        return $._name;
    }

    /**
     * @dev The version parameter for the EIP712 domain.
     *
     * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs
     * are a concern.
     */
    function _EIP712Version() internal view virtual returns (string memory) {
        EIP712Storage storage $ = _getEIP712Storage();
        return $._version;
    }

    /**
     * @dev The hash of the name parameter for the EIP712 domain.
     *
     * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Name` instead.
     */
    function _EIP712NameHash() internal view returns (bytes32) {
        EIP712Storage storage $ = _getEIP712Storage();
        string memory name = _EIP712Name();
        if (bytes(name).length > 0) {
            return keccak256(bytes(name));
        } else {
            // If the name is empty, the contract may have been upgraded without initializing the new storage.
            // We return the name hash in storage if non-zero, otherwise we assume the name is empty by design.
            bytes32 hashedName = $._hashedName;
            if (hashedName != 0) {
                return hashedName;
            } else {
                return keccak256("");
            }
        }
    }

    /**
     * @dev The hash of the version parameter for the EIP712 domain.
     *
     * NOTE: In previous versions this function was virtual. In this version you should override `_EIP712Version` instead.
     */
    function _EIP712VersionHash() internal view returns (bytes32) {
        EIP712Storage storage $ = _getEIP712Storage();
        string memory version = _EIP712Version();
        if (bytes(version).length > 0) {
            return keccak256(bytes(version));
        } else {
            // If the version is empty, the contract may have been upgraded without initializing the new storage.
            // We return the version hash in storage if non-zero, otherwise we assume the version is empty by design.
            bytes32 hashedVersion = $._hashedVersion;
            if (hashedVersion != 0) {
                return hashedVersion;
            } else {
                return keccak256("");
            }
        }
    }
}

File 9 of 31 : PlatformEvents.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.23;

/// @notice Emitted when a configuration has been updated.
/// @param setterSelector The selector of the function that updated the configuration.
/// @param setterSignature The signature of the function that updated the configuration.
/// @param value The abi-encoded data passed to the function that updated the configuration. Since this event will only be emitted by setters, this data corresponds to the updated values in the configuration.
event ConfigChanged(bytes4 indexed setterSelector, string setterSignature, bytes value);

// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.23;

import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";

/// @notice A library for computing merkle tree roots and proofs.
/// @dev This library produces complete trees. If a node does not have a sibling, it is combined with itself.
library Merkle {
    /// @notice A merkle tree.
    /// @dev Contains the leaf hashes at the 0th level, pairwise hashes in the following, and the root in the last.
    struct Tree {
        bytes32[][] hashes;
    }

    function newTreeFromData(bytes[] memory leaves) internal pure returns (Tree memory tree) {
        bytes32[] memory leafDigests = new bytes32[](leaves.length);
        for (uint256 i; i < leaves.length; i++) {
            leafDigests[i] = hashLeaf(leaves[i]);
        }
        return newTree(leafDigests);
    }

    /// @notice Creates a new merkle tree.
    /// @param leafs The leafs of the tree computed with `hashLeaf`.
    function newTree(bytes32[] memory leafs) internal pure returns (Tree memory tree) {
        if (leafs.length == 0) {
            return Tree({hashes: new bytes32[][](0)});
        }

        uint256 depth = Math.log2(leafs.length);
        // round up to the next power of 2
        if (leafs.length != 1 << depth || leafs.length == 1) {
            depth++;
        }

        // +1 for the leafs
        tree.hashes = new bytes32[][](depth + 1);
        tree.hashes[0] = leafs;

        for (uint256 i; i < depth; ++i) {
            tree.hashes[i + 1] = hashPairs(tree.hashes[i], false);
        }
    }

    /// @notice Hashes the raw data of a leaf.
    /// @dev This uses double keccak256 hashing instead of a single one to prevent second-preimage attacks.
    function hashLeaf(bytes memory data) internal pure returns (bytes32) {
        bytes32 hash = keccak256(data);
        assembly {
            mstore(0x00, hash)
            hash := keccak256(0x00, 0x20)
        }
        return hash;
    }

    /// @notice Returns the root of the merkle tree.
    function root(Tree memory tree) internal pure returns (bytes32) {
        if (tree.hashes.length == 0) {
            return bytes32(0);
        }
        return tree.hashes[tree.hashes.length - 1][0];
    }

    /// @notice Computes a merkle proof compatible with OZ's merkle proof validation.
    function proof(Tree memory tree, uint256 leafIdx) internal pure returns (bytes32[] memory) {
        uint256 len = proofLength(tree);
        bytes32[] memory proof_ = new bytes32[](len);

        for (uint256 i; i < len; ++i) {
            bool odd = (leafIdx % 2) == 1;
            uint256 neighbour = odd ? leafIdx - 1 : leafIdx == tree.hashes[i].length - 1 ? leafIdx : leafIdx + 1;

            proof_[i] = tree.hashes[i][neighbour];

            leafIdx /= 2;
        }
        return proof_;
    }

    function proofLength(Tree memory tree) internal pure returns (uint256) {
        // Minus one because proof don't contain the highest level of the tree
        // (i.e. the merkle root).
        return levels(tree) - 1;
    }

    function levels(Tree memory tree) internal pure returns (uint256) {
        return tree.hashes.length;
    }

    function numLeafs(Tree memory tree) internal pure returns (uint256) {
        return tree.hashes[0].length;
    }

    /// @notice Computes the merkle root of the leaves in place.
    /// @dev Caution! This modifies the input array!
    /// @dev This is more efficient than creating a tree and calling `root` on it.
    function computeRootInPlace(bytes32[] memory leaves) internal pure returns (bytes32) {
        if (leaves.length == 0) {
            return bytes32(0);
        }

        // always hash at least once, for the case where leaves.length == 1
        leaves = hashPairs(leaves, true);
        while (leaves.length > 1) {
            leaves = hashPairs(leaves, true);
        }
        return leaves[0];
    }

    function hashPairs(bytes32[] memory leaves, bool inPlace) internal pure returns (bytes32[] memory) {
        uint256 lenOld = leaves.length;
        uint256 lenNew = lenOld / 2;

        bool odd = lenOld % 2 != 0;
        if (odd) {
            lenNew++;
        }

        bytes32[] memory h = leaves;
        if (!inPlace) {
            h = new bytes32[](lenNew);
        }

        uint256 end = odd ? lenNew - 1 : lenNew;
        for (uint256 i; i < end; ++i) {
            h[i] = hashPair(leaves[2 * i], leaves[2 * i + 1]);
        }

        if (odd) {
            h[lenNew - 1] = hashPair(leaves[lenOld - 1], leaves[lenOld - 1]);
        }

        if (inPlace) {
            assembly {
                mstore(h, lenNew)
            }
        }

        return h;
    }

    function hashPair(bytes32 a, bytes32 b) internal pure returns (bytes32) {
        return a < b ? efficientHash(a, b) : efficientHash(b, a);
    }

    function efficientHash(bytes32 a, bytes32 b) internal pure returns (bytes32 value) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, a)
            mstore(0x20, b)
            value := keccak256(0x00, 0x40)
        }
    }
}

// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.23;

interface IGenericRegistry {
    function setBytes32(bytes32 key, bytes32 value) external;
    function setAddress(bytes32 key, address value) external;
    function setUint256(bytes32 key, uint256 value) external;
    function setInt256(bytes32 key, int256 value) external;
    function setBool(bytes32 key, bool value) external;

    function readBytes32(bytes32 key) external view returns (bytes32);
    function readAddress(bytes32 key) external view returns (address);
    function readUint256(bytes32 key) external view returns (uint256);
    function readInt256(bytes32 key) external view returns (int256);
    function readBool(bytes32 key) external view returns (bool);
}

File 12 of 31 : GenericRegistryKeys.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.23;

library GenericRegistryKeys {
    bytes32 constant PLATFORM_CARRY_RECEIVER = keccak256("PLATFORM_CARRY_RECEIVER");
}

// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.23;

import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
import {MessageHashUtils} from "@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol";
import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";

/// @notice USDC pricing data for a token.
/// @dev The amount of USDC for a given amount of tokens is computed by `amountUSDCUnits = (amountTokenUnits * tokenPriceUSDCNumerator) / tokenPriceUSDCDenominator`.
/// e.g. assuming a 18 decimals for the token, and 6 decimals for usdc,
/// an exchange rate of 1 token = 1234.5678 USDC would mean 1e18 tokenUnits = 1,234,567,800 USDCUnits, corresponding to tokenPriceUSDCNumerator = 1234567800 and tokenPriceUSDCDenominator = 1e18.
/// @param tokenPriceUSDCNumerator The numerator of the token unit price in USDC units.
/// @param tokenPriceUSDCDenominator The denominator of the token unit price in USDC units.
struct Price {
    uint256 tokenPriceUSDCNumerator;
    uint256 tokenPriceUSDCDenominator;
}

library PriceLib {
    function convertTokenToUSDC(Price memory data, uint256 amount) internal pure returns (uint256) {
        return Math.mulDiv(amount, data.tokenPriceUSDCNumerator, data.tokenPriceUSDCDenominator);
    }

    function convertUSDCToToken(Price memory data, uint256 usdcAmount) internal pure returns (uint256) {
        return Math.mulDiv(usdcAmount, data.tokenPriceUSDCDenominator, data.tokenPriceUSDCNumerator);
    }
}

struct ClaimData {
    bytes16 tokenDistributionUUID;
    bytes16 entityUUID;
    address receiver;
    uint256 amount;
    Price price;
    uint256 expiresAt;
}

library ClaimDataLib {
    /// @notice EIP-712 typehash for the ClaimData struct.
    bytes32 constant CLAIM_TYPEHASH = keccak256(
        "ClaimData(bytes16 tokenDistributionUUID,bytes16 entityUUID,address receiver,uint256 amount,Price price,uint256 expiresAt)Price(uint256 tokenPriceUSDCNumerator,uint256 tokenPriceUSDCDenominator)"
    );

    /// @notice EIP-712 typehash for the Price struct.
    bytes32 constant PRICE_TYPEHASH =
        keccak256("Price(uint256 tokenPriceUSDCNumerator,uint256 tokenPriceUSDCDenominator)");

    /// @notice Computes the typed data digest of a ClaimData for a given domain separator.
    function digestTypedData(ClaimData memory data, bytes32 domainSeparator) internal pure returns (bytes32) {
        bytes32 priceHash = keccak256(
            abi.encode(PRICE_TYPEHASH, data.price.tokenPriceUSDCNumerator, data.price.tokenPriceUSDCDenominator)
        );

        bytes32 structHash = keccak256(
            abi.encode(
                CLAIM_TYPEHASH,
                data.tokenDistributionUUID,
                data.entityUUID,
                data.receiver,
                data.amount,
                priceHash,
                data.expiresAt
            )
        );

        return MessageHashUtils.toTypedDataHash(domainSeparator, structHash);
    }
}

struct Claimer {
    bytes16 entityUUID;
    address signer;
    uint64 amountInvestedUSDC;
    uint64 distributionShares;
    bool notChargedCarry;
}

struct CarryWithdrawer {
    bytes16 entityUUID;
    address signer;
    uint16 carryBPS;
}

struct CarryWithdrawalData {
    bytes16 tokenDistributionUUID;
    bytes16 entityUUID;
    address receiver;
    uint256 amount;
    uint256 expiresAt;
}

library CarryWithdrawalLib {
    /// @notice EIP-712 typehash for the CarryWithdrawalData struct.
    bytes32 constant CARRY_WITHDRAWAL_DATA_TYPEHASH = keccak256(
        "CarryWithdrawalData(bytes16 tokenDistributionUUID,bytes16 entityUUID,address receiver,uint256 amount,uint256 expiresAt)"
    );

    /// @notice Computes the typed data digest of a CarryWithdrawalData for a given domain separator.
    function digestTypedData(CarryWithdrawalData memory data, bytes32 domainSeparator) internal pure returns (bytes32) {
        bytes32 structHash = keccak256(
            abi.encode(
                CARRY_WITHDRAWAL_DATA_TYPEHASH,
                data.tokenDistributionUUID,
                data.entityUUID,
                data.receiver,
                data.amount,
                data.expiresAt
            )
        );

        return MessageHashUtils.toTypedDataHash(domainSeparator, structHash);
    }
}

// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.23;

/// @notice Interface for Echo Unlocker contracts.
interface IEchoUnlocker {
    function releasable() external view returns (uint256);
    function release() external;
}

/// @notice Interface for Superfluid Unlocker contracts (SuperfluidToken).
/// @dev The unlocker address for Superfluid should be the SuperToken address.
interface ISuperfluidUnlocker {
    function balanceOf(address account) external view returns (uint256);
    function downgrade(uint256 amount) external;
}

/// @notice Library for managing calls to unlocker contracts.
/// @dev The distributor contracts will need to interface with a number of different unlocker contracts.
/// This library provides a dynamic function dispatch to make interacting with Unlocker contracts easier.
library UnlockerLib {
    /// @notice Struct for holding the unlocker contract address and the function types it implements.
    /// @dev This is used to dynamically dispatch calls to the correct function on the unlocker contract as specified by the releasableType and releaseType.
    /// @dev The unlocker address may be 0, in which case no function calls will be made.
    struct Unlocker {
        address unlocker;
        bytes6 releasableType;
        bytes6 releaseType;
    }

    /// Below we list identifiers for functions that might be implemented by unlocker contracts.
    /// EXISTING TYPE MUST NOT BE CHANGED!
    /// If you append new types, make sure to also update the ones in `/backend/lib/contracts/contracts/unlock/types/types.go`
    bytes6 constant NO_TYPE = bytes6(0);
    bytes6 constant ECHO_TYPE = bytes6(keccak256("ECHO"));
    bytes6 constant SUPERFLUID_TYPE = bytes6(keccak256("SUPERFLUID"));

    error InvalidFunctionType(bytes6);
    error InvalidUnlocker(string reason);

    /// @notice Event emitted when the release function on the unlocker contract reverts but we chose to ignore the revert.
    event ReleaseFailedLog(bytes reason);

    /// @notice Returns the amount of tokens that are releasable from the unlocker contract.
    /// @dev This function calls the releasable function on the unlocker contract as specified by the releasableType.
    /// @dev This function does nothing if the unlocker contract address is not set.
    function releasable(Unlocker memory unlocker) internal view returns (uint256) {
        // there is nothing to release if the unlocker is not set
        if (unlocker.unlocker == address(0)) {
            return 0;
        }

        if (unlocker.releasableType == ECHO_TYPE) {
            return IEchoUnlocker(unlocker.unlocker).releasable();
        }

        if (unlocker.releasableType == SUPERFLUID_TYPE) {
            return ISuperfluidUnlocker(unlocker.unlocker).balanceOf(address(this));
        }

        revert InvalidFunctionType(unlocker.releasableType);
    }

    /// @notice Releases the tokens from the unlocker contract.
    /// @dev This function calls the release function on the unlocker contract as specified by the releaseType.
    /// @dev This function will catch any reverts from the release function and emit a log.
    /// @dev This function does nothing if the unlocker contract address is not set.
    function release(Unlocker memory unlocker) internal {
        // there is nothing to release if the unlocker is not set
        // the distributor is receive only in this case
        if (unlocker.unlocker == address(0)) {
            return;
        }

        if (unlocker.releaseType == ECHO_TYPE) {
            try IEchoUnlocker(unlocker.unlocker).release() {}
            catch (bytes memory reason) {
                // emitting a log for easier debugging
                emit ReleaseFailedLog(reason);
            }
            return;
        }

        if (unlocker.releaseType == SUPERFLUID_TYPE) {
            try ISuperfluidUnlocker(unlocker.unlocker)
                .downgrade(ISuperfluidUnlocker(unlocker.unlocker).balanceOf(address(this))) {}
            catch (bytes memory reason) {
                emit ReleaseFailedLog(reason);
            }
            return;
        }

        revert InvalidFunctionType(unlocker.releaseType);
    }

    /// @notice Validates the unlocker struct.
    function validate(Unlocker memory unlocker) internal pure {
        if (unlocker.unlocker == address(0)) {
            if (unlocker.releasableType != NO_TYPE || unlocker.releaseType != NO_TYPE) {
                revert InvalidUnlocker("unlocker is unset but function types are set");
            }
            return;
        }

        if (unlocker.releasableType != ECHO_TYPE && unlocker.releasableType != SUPERFLUID_TYPE) {
            revert InvalidFunctionType(unlocker.releasableType);
        }

        if (unlocker.releaseType != ECHO_TYPE && unlocker.releaseType != SUPERFLUID_TYPE) {
            revert InvalidFunctionType(unlocker.releaseType);
        }
    }
}

File 15 of 31 : Versioned.sol
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.23;

/// @title Versioned
/// @notice A base contract for version control
/// @dev This contract MUST only contain immutable state, since we will also use it for upgradeable contracts.
contract Versioned {
    uint32 private immutable _major;
    uint32 private immutable _minor;
    uint32 private immutable _patch;

    constructor(uint32 major, uint32 minor, uint32 patch) {
        _major = major;
        _minor = minor;
        _patch = patch;
    }

    function version() external view returns (uint32, uint32, uint32) {
        return (_major, _minor, _patch);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

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

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
     */
    function _revert(bytes memory returndata) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert FailedInnerCall();
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.20;

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS
    }

    /**
     * @dev The signature derives the `address(0)`.
     */
    error ECDSAInvalidSignature();

    /**
     * @dev The signature has an invalid length.
     */
    error ECDSAInvalidSignatureLength(uint256 length);

    /**
     * @dev The signature has an S value that is in the upper half order.
     */
    error ECDSAInvalidSignatureS(bytes32 s);

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with `signature` or an error. This will not
     * return address(0) without also returning an error description. Errors are documented using an enum (error type)
     * and a bytes32 providing additional information about the error.
     *
     * If no error is returned, then the address can be used for verification purposes.
     *
     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError, bytes32) {
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            /// @solidity memory-safe-assembly
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength, bytes32(signature.length));
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM precompile allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {MessageHashUtils-toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, signature);
        _throwError(error, errorArg);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     */
    function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError, bytes32) {
        unchecked {
            bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
            // We do not check for an overflow here since the shift operation results in 0 or 1.
            uint8 v = uint8((uint256(vs) >> 255) + 27);
            return tryRecover(hash, v, r, s);
        }
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     */
    function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) {
        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, r, vs);
        _throwError(error, errorArg);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address, RecoverError, bytes32) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS, s);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature, bytes32(0));
        }

        return (signer, RecoverError.NoError, bytes32(0));
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) {
        (address recovered, RecoverError error, bytes32 errorArg) = tryRecover(hash, v, r, s);
        _throwError(error, errorArg);
        return recovered;
    }

    /**
     * @dev Optionally reverts with the corresponding custom error according to the `error` argument provided.
     */
    function _throwError(RecoverError error, bytes32 errorArg) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert ECDSAInvalidSignature();
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert ECDSAInvalidSignatureLength(uint256(errorArg));
        } else if (error == RecoverError.InvalidSignatureS) {
            revert ECDSAInvalidSignatureS(errorArg);
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC1271.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC1271 standard signature validation method for
 * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271].
 */
interface IERC1271 {
    /**
     * @dev Should return whether the signature provided is valid for the provided data
     * @param hash      Hash of the data to be signed
     * @param signature Signature byte array associated with _data
     */
    function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/extensions/IAccessControlEnumerable.sol)

pragma solidity ^0.8.20;

import {IAccessControl} from "../IAccessControl.sol";

/**
 * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.
 */
interface IAccessControlEnumerable is IAccessControl {
    /**
     * @dev Returns one of the accounts that have `role`. `index` must be a
     * value between 0 and {getRoleMemberCount}, non-inclusive.
     *
     * Role bearers are not sorted in any particular way, and their ordering may
     * change at any point.
     *
     * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure
     * you perform all queries on the same block. See the following
     * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]
     * for more information.
     */
    function getRoleMember(bytes32 role, uint256 index) external view returns (address);

    /**
     * @dev Returns the number of accounts that have `role`. Can be used
     * together with {getRoleMember} to enumerate all bearers of a role.
     */
    function getRoleMemberCount(bytes32 role) external view returns (uint256);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)

pragma solidity ^0.8.20;

import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol";
import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
import {ERC165Upgradeable} from "../utils/introspection/ERC165Upgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```solidity
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```solidity
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
 * to enforce additional security measures for this role.
 */
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControl, ERC165Upgradeable {
    struct RoleData {
        mapping(address account => bool) hasRole;
        bytes32 adminRole;
    }

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;


    /// @custom:storage-location erc7201:openzeppelin.storage.AccessControl
    struct AccessControlStorage {
        mapping(bytes32 role => RoleData) _roles;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.AccessControl")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant AccessControlStorageLocation = 0x02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800;

    function _getAccessControlStorage() private pure returns (AccessControlStorage storage $) {
        assembly {
            $.slot := AccessControlStorageLocation
        }
    }

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with an {AccessControlUnauthorizedAccount} error including the required role.
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

    function __AccessControl_init() internal onlyInitializing {
    }

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

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual returns (bool) {
        AccessControlStorage storage $ = _getAccessControlStorage();
        return $._roles[role].hasRole[account];
    }

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
     * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
     * is missing `role`.
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert AccessControlUnauthorizedAccount(account, role);
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {
        AccessControlStorage storage $ = _getAccessControlStorage();
        return $._roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `callerConfirmation`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address callerConfirmation) public virtual {
        if (callerConfirmation != _msgSender()) {
            revert AccessControlBadConfirmation();
        }

        _revokeRole(role, callerConfirmation);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        AccessControlStorage storage $ = _getAccessControlStorage();
        bytes32 previousAdminRole = getRoleAdmin(role);
        $._roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
        AccessControlStorage storage $ = _getAccessControlStorage();
        if (!hasRole(role, account)) {
            $._roles[role].hasRole[account] = true;
            emit RoleGranted(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
        AccessControlStorage storage $ = _getAccessControlStorage();
        if (hasRole(role, account)) {
            $._roles[role].hasRole[account] = false;
            emit RoleRevoked(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

pragma solidity ^0.8.20;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```solidity
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableSet.
 * ====
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

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

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

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

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

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

            if (valueIndex != lastIndex) {
                bytes32 lastValue = set._values[lastIndex];

                // Move the lastValue to the index where the value to delete is
                set._values[valueIndex] = lastValue;
                // Update the tracked position of the lastValue (that was just moved)
                set._positions[lastValue] = position;
            }

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

            // Delete the tracked position for the deleted slot
            delete set._positions[value];

            return true;
        } else {
            return false;
        }
    }

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

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

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

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

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

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

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

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/cryptography/MessageHashUtils.sol)

pragma solidity ^0.8.20;

import {Strings} from "../Strings.sol";

/**
 * @dev Signature message hash utilities for producing digests to be consumed by {ECDSA} recovery or signing.
 *
 * The library provides methods for generating a hash of a message that conforms to the
 * https://eips.ethereum.org/EIPS/eip-191[EIP 191] and https://eips.ethereum.org/EIPS/eip-712[EIP 712]
 * specifications.
 */
library MessageHashUtils {
    /**
     * @dev Returns the keccak256 digest of an EIP-191 signed data with version
     * `0x45` (`personal_sign` messages).
     *
     * The digest is calculated by prefixing a bytes32 `messageHash` with
     * `"\x19Ethereum Signed Message:\n32"` and hashing the result. It corresponds with the
     * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.
     *
     * NOTE: The `messageHash` parameter is intended to be the result of hashing a raw message with
     * keccak256, although any bytes32 value can be safely used because the final digest will
     * be re-hashed.
     *
     * See {ECDSA-recover}.
     */
    function toEthSignedMessageHash(bytes32 messageHash) internal pure returns (bytes32 digest) {
        /// @solidity memory-safe-assembly
        assembly {
            mstore(0x00, "\x19Ethereum Signed Message:\n32") // 32 is the bytes-length of messageHash
            mstore(0x1c, messageHash) // 0x1c (28) is the length of the prefix
            digest := keccak256(0x00, 0x3c) // 0x3c is the length of the prefix (0x1c) + messageHash (0x20)
        }
    }

    /**
     * @dev Returns the keccak256 digest of an EIP-191 signed data with version
     * `0x45` (`personal_sign` messages).
     *
     * The digest is calculated by prefixing an arbitrary `message` with
     * `"\x19Ethereum Signed Message:\n" + len(message)` and hashing the result. It corresponds with the
     * hash signed when using the https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] JSON-RPC method.
     *
     * See {ECDSA-recover}.
     */
    function toEthSignedMessageHash(bytes memory message) internal pure returns (bytes32) {
        return
            keccak256(bytes.concat("\x19Ethereum Signed Message:\n", bytes(Strings.toString(message.length)), message));
    }

    /**
     * @dev Returns the keccak256 digest of an EIP-191 signed data with version
     * `0x00` (data with intended validator).
     *
     * The digest is calculated by prefixing an arbitrary `data` with `"\x19\x00"` and the intended
     * `validator` address. Then hashing the result.
     *
     * See {ECDSA-recover}.
     */
    function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked(hex"19_00", validator, data));
    }

    /**
     * @dev Returns the keccak256 digest of an EIP-712 typed data (EIP-191 version `0x01`).
     *
     * The digest is calculated from a `domainSeparator` and a `structHash`, by prefixing them with
     * `\x19\x01` and hashing the result. It corresponds to the hash signed by the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] JSON-RPC method as part of EIP-712.
     *
     * See {ECDSA-recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 digest) {
        /// @solidity memory-safe-assembly
        assembly {
            let ptr := mload(0x40)
            mstore(ptr, hex"19_01")
            mstore(add(ptr, 0x02), domainSeparator)
            mstore(add(ptr, 0x22), structHash)
            digest := keccak256(ptr, 0x42)
        }
    }
}

File 24 of 31 : IERC5267.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC5267.sol)

pragma solidity ^0.8.20;

interface IERC5267 {
    /**
     * @dev MAY be emitted to signal that the domain could have changed.
     */
    event EIP712DomainChanged();

    /**
     * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712
     * signature.
     */
    function eip712Domain()
        external
        view
        returns (
            bytes1 fields,
            string memory name,
            string memory version,
            uint256 chainId,
            address verifyingContract,
            bytes32 salt,
            uint256[] memory extensions
        );
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)

pragma solidity ^0.8.20;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Muldiv operation overflow.
     */
    error MathOverflowedMulDiv();

    enum Rounding {
        Floor, // Toward negative infinity
        Ceil, // Toward positive infinity
        Trunc, // Toward zero
        Expand // Away from zero
    }

    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @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 towards infinity instead
     * of rounding towards zero.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        if (b == 0) {
            // Guarantee the same behavior as in a regular Solidity division.
            return a / b;
        }

        // (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 = x * y; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

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

            ///////////////////////////////////////////////
            // 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.

            uint256 twos = denominator & (0 - denominator);
            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 (unsignedRoundsUp(rounding) && 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
     * towards zero.
     *
     * 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 + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2 of a positive value rounded towards zero.
     * 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 + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10 of a positive value rounded towards zero.
     * 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 + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256 of a positive value rounded towards zero.
     * 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 256, 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 + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
        }
    }

    /**
     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
     */
    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
        return uint8(rounding) % 2 == 1;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)

pragma solidity ^0.8.20;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev The `account` is missing a role.
     */
    error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);

    /**
     * @dev The caller of a function is not the expected one.
     *
     * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
     */
    error AccessControlBadConfirmation();

    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `callerConfirmation`.
     */
    function renounceRole(bytes32 role, address callerConfirmation) external;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @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 ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {Initializable} from "../../proxy/utils/Initializable.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);
 * }
 * ```
 */
abstract contract ERC165Upgradeable is Initializable, IERC165 {
    function __ERC165_init() internal onlyInitializing {
    }

    function __ERC165_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)

pragma solidity ^0.8.20;

import {Math} from "./math/Math.sol";
import {SignedMath} from "./math/SignedMath.sol";

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

    /**
     * @dev The `value` string doesn't fit in the specified `length`.
     */
    error StringsInsufficientHexLength(uint256 value, uint256 length);

    /**
     * @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), HEX_DIGITS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toStringSigned(int256 value) internal pure returns (string memory) {
        return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value)));
    }

    /**
     * @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) {
        uint256 localValue = value;
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = HEX_DIGITS[localValue & 0xf];
            localValue >>= 4;
        }
        if (localValue != 0) {
            revert StringsInsufficientHexLength(value, length);
        }
        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);
    }

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.20;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

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

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

Settings
{
  "remappings": [
    "forge-std/=lib/forge-std/src/",
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "@openzeppelin-4.9.6/contracts/=lib/openzeppelin-contracts-4.9.6/contracts/",
    "@superfluid-finance/ethereum-contracts/contracts/=lib/superfluid-protocol-monorepo/packages/ethereum-contracts/contracts/",
    "@superfluid-finance/solidity-semantic-money/=lib/superfluid-protocol-monorepo/packages/solidity-semantic-money/",
    "echo/=src/",
    "sales/=src/sales/",
    "ds-test/=lib/openzeppelin-contracts-upgradeable/lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
    "openzeppelin-contracts-4.9.6/=lib/openzeppelin-contracts-4.9.6/",
    "openzeppelin/=lib/openzeppelin-contracts-4.9.6/contracts/",
    "superfluid-protocol-monorepo/=lib/superfluid-protocol-monorepo/packages/solidity-semantic-money/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "shanghai",
  "viaIR": false
}

Contract Security Audit

Contract ABI

API
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"claimableAmount","type":"uint256"}],"name":"AmountExceedsClaimable","type":"error"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"withdrawableAmount","type":"uint256"}],"name":"AmountExceedsWithdrawableCarry","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"bytes16","name":"entityUUID","type":"bytes16"},{"internalType":"address","name":"signer","type":"address"}],"name":"CallerNotAllowed","type":"error"},{"inputs":[{"internalType":"uint256","name":"expiredAt","type":"uint256"}],"name":"ClaimExpired","type":"error"},{"inputs":[{"internalType":"bytes16","name":"entityUUID","type":"bytes16"}],"name":"ClaimerStateAlreadySet","type":"error"},{"inputs":[],"name":"Disabled","type":"error"},{"inputs":[{"internalType":"bytes16","name":"entityUUID","type":"bytes16"}],"name":"DuplicateCarryWithdrawer","type":"error"},{"inputs":[{"internalType":"bytes16","name":"entityUUID","type":"bytes16"}],"name":"DuplicateUser","type":"error"},{"inputs":[],"name":"ECDSAInvalidSignature","type":"error"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"ECDSAInvalidSignatureLength","type":"error"},{"inputs":[{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"ECDSAInvalidSignatureS","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[{"internalType":"bytes32","name":"leaf","type":"bytes32"},{"internalType":"bytes32","name":"got","type":"bytes32"},{"internalType":"bytes32","name":"want","type":"bytes32"}],"name":"InvalidClaimerMerkleProof","type":"error"},{"inputs":[{"internalType":"bytes16","name":"entityUUID","type":"bytes16"}],"name":"InvalidClaimerState","type":"error"},{"inputs":[{"internalType":"string","name":"","type":"string"}],"name":"InvalidConfiguration","type":"error"},{"inputs":[{"internalType":"bytes6","name":"","type":"bytes6"}],"name":"InvalidFunctionType","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[{"internalType":"string","name":"name","type":"string"},{"internalType":"uint256","name":"got","type":"uint256"},{"internalType":"uint256","name":"want","type":"uint256"}],"name":"InvalidPrefillExpectedValue","type":"error"},{"inputs":[{"internalType":"string","name":"reason","type":"string"}],"name":"InvalidUnlocker","type":"error"},{"inputs":[],"name":"MathOverflowedMulDiv","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[{"internalType":"address","name":"signer","type":"address"}],"name":"UnauthorizedPlatformSigner","type":"error"},{"inputs":[{"internalType":"address","name":"got","type":"address"},{"internalType":"address","name":"want","type":"address"}],"name":"UnauthorizedUserSigner","type":"error"},{"inputs":[{"internalType":"bytes32[]","name":"leafs","type":"bytes32[]"},{"internalType":"bytes32","name":"got","type":"bytes32"},{"internalType":"bytes32","name":"want","type":"bytes32"}],"name":"UnexpectedClaimerMerkleRoot","type":"error"},{"inputs":[],"name":"UnknownUser","type":"error"},{"inputs":[{"internalType":"bytes16","name":"entityUUID","type":"bytes16"}],"name":"WithdrawerStateAlreadySet","type":"error"},{"inputs":[{"internalType":"bytes16","name":"got","type":"bytes16"},{"internalType":"bytes16","name":"want","type":"bytes16"}],"name":"WrongTokenDistribution","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes16","name":"tokenDistributionUUID","type":"bytes16"},{"indexed":true,"internalType":"bytes16","name":"entityUUID","type":"bytes16"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"CarryWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes16","name":"tokenDistributionUUID","type":"bytes16"},{"indexed":true,"internalType":"bytes16","name":"entityUUID","type":"bytes16"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountUSDC","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountCarry","type":"uint256"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes4","name":"setterSelector","type":"bytes4"},{"indexed":false,"internalType":"string","name":"setterSignature","type":"string"},{"indexed":false,"internalType":"bytes","name":"value","type":"bytes"}],"name":"ConfigChanged","type":"event"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"reason","type":"bytes"}],"name":"ReleaseFailedLog","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ENG_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ENG_MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAUSER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PLATFORM_CARRY_WITHDRAWER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PLATFORM_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PREFILL_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SIGNER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes16","name":"entityUUID","type":"bytes16"},{"internalType":"uint64","name":"amountInvestedUSDC","type":"uint64"},{"internalType":"bool","name":"notChargedCarry","type":"bool"},{"internalType":"uint256","name":"amountToClaim","type":"uint256"}],"internalType":"struct Distributor.CalculateCarryAmountClaimParameters[]","name":"claimParams","type":"tuple[]"},{"components":[{"internalType":"uint256","name":"tokenPriceUSDCNumerator","type":"uint256"},{"internalType":"uint256","name":"tokenPriceUSDCDenominator","type":"uint256"}],"internalType":"struct Price","name":"price","type":"tuple"}],"name":"calculateCarryAmountForClaims","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes16[]","name":"entityUUIDs","type":"bytes16[]"}],"name":"carryWithdrawable","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"carryWithdrawablePlatform","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes16[]","name":"entityUUIDs","type":"bytes16[]"}],"name":"carryWithdrawer","outputs":[{"components":[{"internalType":"address","name":"signer","type":"address"},{"internalType":"uint16","name":"carryBPS","type":"uint16"}],"internalType":"struct Distributor.CarryWithdrawerWithoutUUID[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"carryWithdrawerUUIDs","outputs":[{"internalType":"bytes16[]","name":"","type":"bytes16[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes16[]","name":"entityUUIDs","type":"bytes16[]"}],"name":"carryWithdrawn","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"carryWithdrawnPlatform","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes16","name":"tokenDistributionUUID","type":"bytes16"},{"internalType":"bytes16","name":"entityUUID","type":"bytes16"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"components":[{"internalType":"uint256","name":"tokenPriceUSDCNumerator","type":"uint256"},{"internalType":"uint256","name":"tokenPriceUSDCDenominator","type":"uint256"}],"internalType":"struct Price","name":"price","type":"tuple"},{"internalType":"uint256","name":"expiresAt","type":"uint256"}],"internalType":"struct ClaimData","name":"claimData","type":"tuple"},{"internalType":"bytes","name":"claimSignatureUser","type":"bytes"},{"internalType":"bytes","name":"claimSignaturePlatform","type":"bytes"},{"components":[{"internalType":"bytes16","name":"entityUUID","type":"bytes16"},{"internalType":"address","name":"signer","type":"address"},{"internalType":"uint64","name":"amountInvestedUSDC","type":"uint64"},{"internalType":"uint64","name":"distributionShares","type":"uint64"},{"internalType":"bool","name":"notChargedCarry","type":"bool"}],"internalType":"struct Claimer","name":"user","type":"tuple"},{"internalType":"bytes32[]","name":"merkleProof","type":"bytes32[]"},{"internalType":"bool","name":"pullUnlocked","type":"bool"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes16[]","name":"entityUUIDs","type":"bytes16[]"},{"internalType":"uint64[]","name":"distributionShares","type":"uint64[]"},{"internalType":"bool","name":"includeReleasable","type":"bool"}],"name":"claimable","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes16[]","name":"entityUUID","type":"bytes16[]"}],"name":"claimed","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes16[]","name":"entityUUID","type":"bytes16[]"}],"name":"claimerStates","outputs":[{"components":[{"internalType":"uint256","name":"amountClaimed","type":"uint256"},{"internalType":"uint64","name":"amountClaimedUSDC","type":"uint64"}],"internalType":"struct Distributor.ClaimerState[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimersRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"domainSeparator","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"totalCarryGenerated_","type":"uint256"},{"internalType":"uint256","name":"expectedTotalClaimed_","type":"uint256"},{"internalType":"uint256","name":"expectedTotalCarryWithdrawn_","type":"uint256"}],"name":"finalizePrefill","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"genericRegistry","outputs":[{"internalType":"contract IGenericRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"bytes16","name":"tokenDistributionUUID","type":"bytes16"},{"components":[{"internalType":"address","name":"unlocker","type":"address"},{"internalType":"bytes6","name":"releasableType","type":"bytes6"},{"internalType":"bytes6","name":"releaseType","type":"bytes6"}],"internalType":"struct UnlockerLib.Unlocker","name":"unlocker","type":"tuple"},{"internalType":"contract IGenericRegistry","name":"genericRegistry","type":"address"},{"components":[{"internalType":"bytes16","name":"entityUUID","type":"bytes16"},{"internalType":"address","name":"signer","type":"address"},{"internalType":"uint64","name":"amountInvestedUSDC","type":"uint64"},{"internalType":"uint64","name":"distributionShares","type":"uint64"},{"internalType":"bool","name":"notChargedCarry","type":"bool"}],"internalType":"struct Claimer[]","name":"claimers","type":"tuple[]"},{"components":[{"internalType":"bytes16","name":"entityUUID","type":"bytes16"},{"internalType":"address","name":"signer","type":"address"},{"internalType":"uint16","name":"carryBPS","type":"uint16"}],"internalType":"struct CarryWithdrawer[]","name":"carryWithdrawers","type":"tuple[]"},{"internalType":"address","name":"adminIM","type":"address"},{"internalType":"address","name":"managerIM","type":"address"},{"internalType":"address","name":"adminENG","type":"address"},{"internalType":"address","name":"managerENG","type":"address"},{"internalType":"address","name":"platformSigner","type":"address"},{"internalType":"address","name":"platformSender","type":"address"},{"internalType":"bytes32","name":"expectedClaimersRoot","type":"bytes32"},{"internalType":"uint16","name":"platformCarryBPS","type":"uint16"}],"internalType":"struct Distributor.Init","name":"init","type":"tuple"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isForcedDistributionModeEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"platformCarryBPS","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes16","name":"entityUUID","type":"bytes16"},{"components":[{"internalType":"uint256","name":"amountClaimed","type":"uint256"},{"internalType":"uint64","name":"amountClaimedUSDC","type":"uint64"}],"internalType":"struct Distributor.ClaimerState","name":"state","type":"tuple"}],"internalType":"struct Distributor.PrefillDataClaimerState[]","name":"states","type":"tuple[]"}],"name":"prefillClaimerStates","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes16","name":"entityUUID","type":"bytes16"},{"internalType":"uint256","name":"amountCarryWithdrawn","type":"uint256"}],"internalType":"struct Distributor.PrefillDataWithdrawerState[]","name":"states","type":"tuple[]"}],"name":"prefillWithdrawerStates","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"pullUnlockedTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"coin","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"recoverTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes16","name":"entityUUID","type":"bytes16"},{"internalType":"address","name":"signer","type":"address"},{"internalType":"uint16","name":"carryBPS","type":"uint16"}],"internalType":"struct CarryWithdrawer[]","name":"settings","type":"tuple[]"}],"name":"setCarryWithdrawerSettings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"bytes16","name":"entityUUID","type":"bytes16"},{"internalType":"address","name":"signer","type":"address"},{"internalType":"uint64","name":"amountInvestedUSDC","type":"uint64"},{"internalType":"uint64","name":"distributionShares","type":"uint64"},{"internalType":"bool","name":"notChargedCarry","type":"bool"}],"internalType":"struct Claimer[]","name":"claimers","type":"tuple[]"},{"internalType":"bytes32","name":"expectedRoot","type":"bytes32"}],"name":"setClaimers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"isEnabled_","type":"bool"}],"name":"setEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"enabled","type":"bool"}],"name":"setForcedDistributionModeEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IGenericRegistry","name":"registry","type":"address"}],"name":"setGenericRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"bps","type":"uint16"}],"name":"setPlatformCarryBPS","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"unlocker","type":"address"},{"internalType":"bytes6","name":"releasableType","type":"bytes6"},{"internalType":"bytes6","name":"releaseType","type":"bytes6"}],"internalType":"struct UnlockerLib.Unlocker","name":"unlocker_","type":"tuple"}],"name":"setUnlocker","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenDistributionUUID","outputs":[{"internalType":"bytes16","name":"","type":"bytes16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalCarryBPS","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalCarryGenerated","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalCarryWithdrawn","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalClaimed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalDistributionShares","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unlocker","outputs":[{"internalType":"address","name":"unlocker","type":"address"},{"internalType":"bytes6","name":"releasableType","type":"bytes6"},{"internalType":"bytes6","name":"releaseType","type":"bytes6"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint32","name":"","type":"uint32"},{"internalType":"uint32","name":"","type":"uint32"},{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"bytes16","name":"tokenDistributionUUID","type":"bytes16"},{"internalType":"bytes16","name":"entityUUID","type":"bytes16"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"expiresAt","type":"uint256"}],"internalType":"struct CarryWithdrawalData","name":"data","type":"tuple"},{"internalType":"bytes","name":"userSignature","type":"bytes"},{"internalType":"bytes","name":"platformSignature","type":"bytes"}],"name":"withdrawCarry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdrawCarryPlatform","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60e060405234801562000010575f80fd5b5060026080525f60a081905260c052620000296200002f565b620000e3565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff1615620000805760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b0390811614620000e05780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b60805160a05160c051615bb36200010e5f395f61060401525f6105dc01525f6105b70152615bb35ff3fe608060405234801561000f575f80fd5b5060043610610392575f3560e01c80638456cb59116101df578063b82538bd11610109578063e2ca5974116100a9578063f83f55a911610079578063f83f55a914610927578063fc0c546a1461093b578063fdf25f331461094e578063ff3c2f8914610961575f80fd5b8063e2ca5974146108d1578063e63ab1e9146108e4578063ec87621c1461090b578063f698da251461091f575f80fd5b8063cf055d5c116100e4578063cf055d5c1461088d578063d547741f146108a1578063d54ad2a1146108b4578063e00549ab146108bd575f80fd5b8063b82538bd14610841578063c824166f14610867578063ca15c8731461087a575f80fd5b8063a217fddf1161017f578063ae2560af1161014f578063ae2560af146107d6578063b212f067146107e9578063b3061b911461081b578063b6870c5a1461082e575f80fd5b8063a217fddf1461078a578063a377052314610791578063a8981e731461079a578063a8fc9e29146107af575f80fd5b80639010d07c116101ba5780639010d07c1461074857806391d148541461075b5780639dc69e1f1461076e578063a1ebf35d14610776575f80fd5b80638456cb591461071c57806384b0196e146107245780638f22602e1461073f575f80fd5b80633f953f9a116102c05780635f3e849f116102605780636adc3168116102305780636adc31681461069357806370824c5c146106c257806373852d27146106e95780638164183e14610709575f80fd5b80635f3e849f14610646578063601ed31b14610659578063652cce511461066c5780636aa633b61461067f575f80fd5b80634407390d1161029b5780634407390d146105865780634925abac1461059957806354fd4d50146105ac57806358941f1e14610633575f80fd5b80633f953f9a1461054a57806340b40f551461055d5780634111bf9d1461057d575f80fd5b806326e670ea11610336578063342cf27a11610306578063342cf27a1461050757806336568abe1461051a5780633ba930ad1461052d5780633d24f8f714610542575f80fd5b806326e670ea146104ae5780632f2ff15d146104ce5780632fc2ec02146104e1578063328d8f72146104f4575f80fd5b806319a1e5871161037157806319a1e5871461042d57806320ab083e146104415780632257310f1461046c578063248a9ca31461048d575f80fd5b80620769431461039657806301ffc9a7146103f5578063052548e914610418575b5f80fd5b5f546103c0906001600160a01b03811690600160a01b810460d090811b91600160d01b9004901b83565b604080516001600160a01b0390941684526001600160d01b031992831660208501529116908201526060015b60405180910390f35b610408610403366004614687565b610974565b60405190151581526020016103ec565b61042b6104263660046149ef565b61099e565b005b60025461040890600160a81b900460ff1681565b600154610454906001600160a01b031681565b6040516001600160a01b0390911681526020016103ec565b60075461047a9061ffff1681565b60405161ffff90911681526020016103ec565b6104a061049b366004614b4f565b610d7c565b6040519081526020016103ec565b6104c16104bc366004614bad565b610d9c565b6040516103ec9190614c25565b61042b6104dc366004614c37565b610e66565b61042b6104ef366004614c65565b610e88565b61042b610502366004614cd8565b610efa565b6104c1610515366004614cf3565b610f1e565b61042b610528366004614c37565b610ff8565b60035461047a90600160c01b900461ffff1681565b61042b611030565b61042b610558366004614db0565b611082565b61057061056b366004614bad565b6110f3565b6040516103ec9190614de2565b6104a0600a5481565b61042b610594366004614e39565b6111ec565b6104c16105a7366004614bad565b611226565b6040805163ffffffff7f0000000000000000000000000000000000000000000000000000000000000000811682527f0000000000000000000000000000000000000000000000000000000000000000811660208301527f000000000000000000000000000000000000000000000000000000000000000016918101919091526060016103ec565b61042b610641366004614cd8565b61131a565b61042b610654366004614e54565b611350565b61042b610667366004614e92565b61137b565b61042b61067a366004614b4f565b611419565b60025461040890600160a01b900460ff1681565b5f805260096020527fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b546104a0565b6104a07f797343f8d6a29aafeb3aaf0910a8973e0081c60c2f6c1f775cd9f76ea348fc1e81565b6106fc6106f7366004614bad565b6115cc565b6040516103ec9190614ea8565b61042b610717366004614db0565b6116cc565b61042b611815565b61072c61184b565b6040516103ec9796959493929190614f43565b6104a060065481565b610454610756366004614fb2565b6118f4565b610408610769366004614c37565b611921565b6104a0611957565b6104a05f80516020615afe83398151915281565b6104a05f81565b6104a060055481565b6107a2611970565b6040516103ec9190614fd2565b6104a07faeaff0ba5714de3101330cd09333f32afb2556d1f0ec0469ef94ffe1e27c4bca81565b6104c16107e4366004614bad565b6119f2565b60035461080390600160801b90046001600160401b031681565b6040516001600160401b0390911681526020016103ec565b61042b61082936600461501f565b611aae565b6104c161083c366004615048565b611b8e565b60035461084e9060801b81565b6040516001600160801b031990911681526020016103ec565b61042b6108753660046150d1565b611cb9565b6104a0610888366004614b4f565b611d9a565b6104a05f80516020615ade83398151915281565b61042b6108af366004614c37565b611dbe565b6104a060045481565b6104a05f80516020615b5e83398151915281565b61042b6108df3660046150ea565b611dda565b6104a07f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b6104a05f80516020615abe83398151915281565b6104a0611ee4565b6104a05f80516020615b3e83398151915281565b600254610454906001600160a01b031681565b61042b61095c3660046151a5565b611eed565b61042b61096f366004615220565b612318565b5f6001600160e01b03198216635a05180f60e01b148061099857506109988261236d565b92915050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff1615906001600160401b03165f811580156109e25750825b90505f826001600160401b031660011480156109fd5750303b155b905081158015610a0b575080155b15610a295760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff191660011785558315610a5357845460ff60401b1916600160401b1785555b610a5b6123a1565b610aa16040518060400160405280600b81526020016a2234b9ba3934b13aba37b960a91b815250604051806040016040528060018152602001603160f81b8152506123a9565b610ad85f80516020615b3e8339815191527faeaff0ba5714de3101330cd09333f32afb2556d1f0ec0469ef94ffe1e27c4bca6123bb565b610afc5f80516020615afe8339815191525f80516020615b3e8339815191526123bb565b610b205f80516020615ade8339815191525f80516020615b3e8339815191526123bb565b610b305f801b8760c0015161241b565b50610b4c5f80516020615abe8339815191528760e0015161241b565b50610b7c7faeaff0ba5714de3101330cd09333f32afb2556d1f0ec0469ef94ffe1e27c4bca87610100015161241b565b50610b995f80516020615b3e83398151915287610120015161241b565b50610bb65f80516020615afe83398151915287610140015161241b565b50610bd35f80516020615ade83398151915287610160015161241b565b50610c037f797343f8d6a29aafeb3aaf0910a8973e0081c60c2f6c1f775cd9f76ea348fc1e87610160015161241b565b50610c337f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a87610160015161241b565b50610c41866040015161245d565b60408681015180515f805460208085015194909501516001600160a01b039384166001600160d01b031990921691909117600160a01b60d095861c02176001600160d01b0316600160d01b9190941c02929092179091556060880151600180546001600160a01b03199081169284169290921790558851600280549092169216919091179055860151600380546001600160801b031916608092831c1790556101a08701516007805461ffff191661ffff909216919091179055860151610180870151610d0e91906125d4565b610d1b8660a0015161288e565b6002805460ff60a01b1916600160a01b1790558315610d7457845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b505050505050565b5f9081525f80516020615b1e833981519152602052604090206001015490565b60605f826001600160401b03811115610db757610db76146ae565b604051908082528060200260200182016040528015610de0578160200160208202803683370190505b5090505f5b83811015610e5e5760095f868684818110610e0257610e026152f4565b9050602002016020810190610e179190615308565b6001600160801b0319166001600160801b03191681526020019081526020015f2054828281518110610e4b57610e4b6152f4565b6020908102919091010152600101610de5565b509392505050565b610e6f82610d7c565b610e7881612b82565b610e82838361241b565b50505050565b5f80516020615abe833981519152610e9f81612b82565b610e828484808060200260200160405190810160405280939291908181526020015f905b82821015610eef57610ee060a08302860136819003810190615321565b81526020019060010190610ec3565b5050505050836125d4565b5f80516020615b3e833981519152610f1181612b82565b610f1a82612b8c565b5050565b60605f856001600160401b03811115610f3957610f396146ae565b604051908082528060200260200182016040528015610f62578160200160208202803683370190505b5090505f5b86811015610feb57610fc6888883818110610f8457610f846152f4565b9050602002016020810190610f999190615308565b878784818110610fab57610fab6152f4565b9050602002016020810190610fc0919061533b565b86612c0c565b828281518110610fd857610fd86152f4565b6020908102919091010152600101610f67565b5090505b95945050505050565b6001600160a01b03811633146110215760405163334bd91960e11b815260040160405180910390fd5b61102b8282612d6c565b505050565b604080516060810182525f546001600160a01b03811682526001600160d01b0319600160a01b820460d090811b82166020850152600160d01b90920490911b169181019190915261108090612da5565b565b5f80516020615abe83398151915261109981612b82565b61102b8383808060200260200160405190810160405280939291908181526020015f905b828210156110e9576110da60608302860136819003810190615356565b815260200190600101906110bd565b505050505061288e565b60605f826001600160401b0381111561110e5761110e6146ae565b60405190808252806020026020018201604052801561115257816020015b604080518082019091525f808252602082015281526020019060019003908161112c5790505b5090505f5b83811015610e5e5760085f868684818110611174576111746152f4565b90506020020160208101906111899190615308565b6001600160801b031916815260208082019290925260409081015f20815180830190925280548252600101546001600160401b03169181019190915282518390839081106111d9576111d96152f4565b6020908102919091010152600101611157565b5f80516020615abe83398151915261120381612b82565b50600180546001600160a01b0319166001600160a01b0392909216919091179055565b60605f826001600160401b03811115611241576112416146ae565b60405190808252806020026020018201604052801561126a578160200160208202803683370190505b5090505f5b83811015610e5e576112f585858381811061128c5761128c6152f4565b90506020020160208101906112a19190615308565b600b5f8888868181106112b6576112b66152f4565b90506020020160208101906112cb9190615308565b6001600160801b031916815260208101919091526040015f2054600160a01b900461ffff16612f7e565b828281518110611307576113076152f4565b602090810291909101015260010161126f565b5f80516020615abe83398151915261133181612b82565b5060028054911515600160a81b0260ff60a81b19909216919091179055565b5f80516020615abe83398151915261136781612b82565b610e826001600160a01b0385168484612fc0565b5f80516020615b3e83398151915261139281612b82565b6113a96113a436849003840184615370565b61245d565b815f6113b5828261538a565b505060405163601ed31b60e01b907f11f2fec7a1604d7d8ea8b74ed1666060410561f7e666aee037dcf3f9292cb4c1906113f39085906020016153fd565b60408051601f198184030181529082905261140d91615455565b60405180910390a25050565b5f80516020615ade83398151915261143081612b82565b600154604051639d84ae6960e01b81527f35bd7c3085200665404055ee8facd7c7cf131f375247edf256b95933d81b07b460048201525f916001600160a01b031690639d84ae6990602401602060405180830381865afa158015611496573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114ba91906154a8565b6007549091505f906114d190829061ffff16612f7e565b90508084111561150357604051630f4da97960e41b815260048101859052602481018290526044015b60405180910390fd5b5f80805260096020527fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b805486929061153d9084906154d7565b925050819055508360065f82825461155591906154d7565b90915550506003546040516001600160a01b038416915f9160809190911b6001600160801b031916907f7ed4454676b40d92244b47fc7a6ef3aab0808cbf85d84fc65676a040343d4823906115ad9089815260200190565b60405180910390a4600254610e82906001600160a01b03168386612fc0565b60605f826001600160401b038111156115e7576115e76146ae565b60405190808252806020026020018201604052801561162b57816020015b604080518082019091525f80825260208201528152602001906001900390816116055790505b5090505f5b83811015610e5e57600b5f86868481811061164d5761164d6152f4565b90506020020160208101906116629190615308565b6001600160801b031916815260208082019290925260409081015f208151808301909252546001600160a01b0381168252600160a01b900461ffff169181019190915282518390839081106116b9576116b96152f4565b6020908102919091010152600101611630565b5f80516020615b5e8339815191526116e381612b82565b6004545f5b8381101561180c575f858583818110611703576117036152f4565b6117199260206060909202019081019150615308565b90503686868481811061172e5761172e6152f4565b90506060020160200190505f81602001602081019061174d919061533b565b6001600160401b03161115155f825f01351115151461178b576040516329a440e160e01b81526001600160801b0319831660048201526024016114fa565b6001600160801b031982165f90815260086020526040902054156117ce5760405163536c104560e11b81526001600160801b0319831660048201526024016114fa565b6001600160801b031982165f90815260086020526040902081906117f282826154ea565b5061180090508135856154d7565b935050506001016116e8565b50600455505050565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a61183f81612b82565b6118485f612b8c565b50565b5f60608082808083815f80516020615a9e833981519152805490915015801561187657506001810154155b6118ba5760405162461bcd60e51b81526020600482015260156024820152741152540dcc4c8e88155b9a5b9a5d1a585b1a5e9959605a1b60448201526064016114fa565b6118c2613012565b6118ca6130d2565b604080515f80825260208201909252600f60f81b9c939b5091995046985030975095509350915050565b5f8281525f80516020615a7e8339815191526020819052604082206119199084613110565b949350505050565b5f9182525f80516020615b1e833981519152602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6007545f9061196b90829061ffff16612f7e565b905090565b6060600c8054806020026020016040519081016040528092919081815260200182805480156119e857602002820191905f5260205f20905f905b82829054906101000a900460801b6001600160801b03191681526020019060100190602082600f010492830192600103820291508084116119aa5790505b5050505050905090565b60605f826001600160401b03811115611a0d57611a0d6146ae565b604051908082528060200260200182016040528015611a36578160200160208202803683370190505b5090505f5b83811015610e5e5760085f868684818110611a5857611a586152f4565b9050602002016020810190611a6d9190615308565b6001600160801b031916815260208101919091526040015f20548251839083908110611a9b57611a9b6152f4565b6020908102919091010152600101611a3b565b5f80516020615b5e833981519152611ac581612b82565b60058490556004548314611b1d57600480546040516315d3fa8760e01b8152606092810192909252600c60648301526b1d1bdd185b10db185a5b595960a21b608483015260248201526044810184905260a4016114fa565b8160065414611b77576006546040516315d3fa8760e01b81526060600482015260136064820152723a37ba30b621b0b9393cabb4ba34323930bbb760691b608482015260248101919091526044810183905260a4016114fa565b610e825f80516020615b5e83398151915233610ff8565b60605f836001600160401b03811115611ba957611ba96146ae565b604051908082528060200260200182016040528015611bd2578160200160208202803683370190505b5090505f5b84811015611cae57611c89868683818110611bf457611bf46152f4565b611c0a9260206080909202019081019150615308565b878784818110611c1c57611c1c6152f4565b9050608002016020016020810190611c34919061533b565b6001600160401b0316888885818110611c4f57611c4f6152f4565b9050608002016040016020810190611c679190614cd8565b898986818110611c7957611c796152f4565b905060800201606001358861311b565b828281518110611c9b57611c9b6152f4565b6020908102919091010152600101611bd7565b5090505b9392505050565b5f80516020615abe833981519152611cd081612b82565b6107d08261ffff161115611d3d576040516301f6ffb960e31b815260206004820152602d60248201527f506c6174666f726d206361727279204250532063616e6e6f742062652067726560448201526c61746572207468616e2032302560981b60648201526084016114fa565b6007546003548391611d5e9161ffff91821691600160c01b90910416615520565b611d68919061553b565b6003805461ffff60c01b1916600160c01b61ffff938416021790556007805461ffff1916939091169290921790915550565b5f8181525f80516020615a7e833981519152602081905260408220611cb2906131b4565b611dc782610d7c565b611dd081612b82565b610e828383612d6c565b5f80516020615b5e833981519152611df181612b82565b6006545f5b83811015611edb575f858583818110611e1157611e116152f4565b611e279260206040909202019081019150615308565b6001600160801b031981165f9081526009602052604090205490915015611e6d576040516315adf33960e21b81526001600160801b0319821660048201526024016114fa565b858583818110611e7f57611e7f6152f4565b6001600160801b031984165f908152600960209081526040918290209190920293909301013590915550858583818110611ebb57611ebb6152f4565b9050604002016020013583611ed091906154d7565b925050600101611df6565b50600655505050565b5f61196b6131bd565b600254600160a01b900460ff1680611f1857604051633ac4266d60e11b815260040160405180910390fd5b60035460801b6001600160801b031916611f356020880188615308565b6001600160801b03191614611f8857611f516020870187615308565b6003546040516308d9a7fb60e41b81526114fa929160801b906004016001600160801b031992831681529116602082015260400190565b85608001354210611fb257604051630f5f3b2360e41b8152608087013560048201526024016114fa565b5f600b81611fc660408a0160208b01615308565b6001600160801b031916815260208082019290925260409081015f208151808301909252546001600160a01b038116808352600160a01b90910461ffff1692820192909252915061202a57604051637d469caf60e11b815260040160405180910390fd5b5f61204a61203d368a90038a018a615556565b6120456131bd565b6131c6565b600254909150600160a81b900460ff161580156120a757506120a5825f01518289898080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061328b92505050565b155b1561211e575f6120ec8289898080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152506132ea92505050565b8351604051631fb7a3a360e01b81526001600160a01b03808416600483015290911660248201529091506044016114fa565b5f61215e8287878080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152506132ea92505050565b90506121775f80516020615afe83398151915282611921565b61219f576040516301120d5160e31b81526001600160a01b03821660048201526024016114fa565b505f90506121c06121b660408a0160208b01615308565b8360200151612f7e565b905080886060013511156121f457604051630f4da97960e41b815260608901356004820152602481018290526044016114fa565b50606087013560095f61220d60408b0160208c01615308565b6001600160801b0319166001600160801b03191681526020019081526020015f205f82825461223c91906154d7565b92505081905550866060013560065f82825461225891906154d7565b9091555061226e90506060880160408901614e39565b6001600160a01b03166122876040890160208a01615308565b6001600160801b03191661229e60208a018a615308565b6001600160801b0319167f7ed4454676b40d92244b47fc7a6ef3aab0808cbf85d84fc65676a040343d48238a606001356040516122dd91815260200190565b60405180910390a461230f6122f86060890160408a01614e39565b6002546001600160a01b03169060608a0135612fc0565b50505050505050565b600254600160a01b900460ff168061234357604051633ac4266d60e11b815260040160405180910390fd5b811561235157612351611030565b6123618a8a8a8a8a8a8a8a613312565b50505050505050505050565b5f6001600160e01b03198216637965db0b60e01b148061099857506301ffc9a760e01b6001600160e01b0319831614610998565b6110806137d6565b6123b16137d6565b610f1a828261381f565b5f80516020615b1e8339815191525f6123d384610d7c565b5f85815260208490526040808220600101869055519192508491839187917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a450505050565b5f5f80516020615a7e83398151915281612435858561387e565b90508015611919575f8581526020839052604090206124549085613926565b50949350505050565b80516001600160a01b03166124f85760208101516001600160d01b031916151580612495575060408101516001600160d01b03191615155b1561184857604051632e3505a960e01b815260206004820152602c60248201527f756e6c6f636b657220697320756e736574206275742066756e6374696f6e207460448201526b1e5c195cc8185c99481cd95d60a21b60648201526084016114fa565b60208101516001600160d01b031916650448a88550a960d11b14801590612536575060208101516001600160d01b031916654d8ad6b7fe1b60d01b14155b1561256657602081015160405163084523c560e11b81526001600160d01b031990911660048201526024016114fa565b60408101516001600160d01b031916650448a88550a960d11b148015906125a4575060408101516001600160d01b031916654d8ad6b7fe1b60d01b14155b1561184857604080820151905163084523c560e11b81526001600160d01b031990911660048201526024016114fa565b5f8083516001600160401b038111156125ef576125ef6146ae565b604051908082528060200260200182016040528015612618578160200160208202803683370190505b5090505f5b845181101561282d575f858281518110612639576126396152f4565b602090810291909101015180519091506001600160801b031916612670576040516301f6ffb960e31b81526004016114fa906155ba565b60208101516001600160a01b03166126bc576040516301f6ffb960e31b815260206004820152600e60248201526d7369676e6572206973207a65726f60901b60448201526064016114fa565b80604001516001600160401b03165f03612719576040516301f6ffb960e31b815260206004820152601760248201527f616d6f756e7420696e766573746564206973207a65726f00000000000000000060448201526064016114fa565b80606001516001600160401b03165f03612776576040516301f6ffb960e31b815260206004820152601a60248201527f646973747269627574696f6e536861726573206973207a65726f00000000000060448201526064016114fa565b60608101516127859085615606565b6040805183516001600160801b0319166020808301919091528401516001600160a01b031681830152908301516001600160401b0390811660608084019190915284015116608080830191909152830151151560a08201529094506128079060c0015b60405160208183030381529060405280516020918201205f9081522090565b838381518110612819576128196152f4565b60209081029190910101525060010161261d565b506003805467ffffffffffffffff60801b1916600160801b6001600160401b038516021790555f61285d8261393a565b9050838114612885578181856040516316af695b60e11b81526004016114fa93929190615626565b600a5550505050565b600c548015612910575f5b8181101561290457600b5f600c83815481106128b7576128b76152f4565b5f918252602080832060028304015460019283166010026101000a900460801b6001600160801b03191684528301939093526040909101902080546001600160b01b031916905501612899565b50612910600c5f614652565b5f805b8351811015612b4f575f84828151811061292f5761292f6152f4565b602090810291909101015180519091506001600160801b031916612966576040516301f6ffb960e31b81526004016114fa906155ba565b60208101516001600160a01b03166129b2576040516301f6ffb960e31b815260206004820152600e60248201526d7369676e6572206973207a65726f60901b60448201526064016114fa565b806040015161ffff165f036129fe576040516301f6ffb960e31b8152602060048201526011602482015270636172727920425053206973207a65726f60781b60448201526064016114fa565b80516001600160801b0319165f908152600b60205260409020546001600160a01b031615612a6f576040516301f6ffb960e31b815260206004820152601960248201527f656e746974795555494420616c7265616479206578697374730000000000000060448201526064016114fa565b6040810151612a7e908461553b565b8151600c8054600180820183555f9283527fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c7600283040180546001600160801b039383166010026101000a938402191660809590951c929092029390931790556040805180820182526020808701516001600160a01b0390811683528388015161ffff90811683850190815298516001600160801b0319168652600b9092529290932090518154965192166001600160b01b031990961695909517600160a01b919092160217909255925001612913565b50600754612b619061ffff168261553b565b600360186101000a81548161ffff021916908361ffff160217905550505050565b6118488133613995565b60028054821515600160a01b0260ff60a01b19909116179055604051631946c7b960e11b907f11f2fec7a1604d7d8ea8b74ed1666060410561f7e666aee037dcf3f9292cb4c190612be7908490602001901515815260200190565b60408051601f1981840301815290829052612c0191615674565b60405180910390a250565b5f80600654600554600454612c2191906156ad565b6002546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015612c67573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612c8b91906156c0565b612c9591906154d7565b612c9f91906154d7565b90508215612d0457604080516060810182525f546001600160a01b03811682526001600160d01b0319600160a01b820460d090811b82166020850152600160d01b90920490911b1691810191909152612cf7906139ce565b612d0190826154d7565b90505b6003545f90612d289083906001600160401b0380891691600160801b900416613af5565b6001600160801b031987165f9081526008602052604090205490915080821015612d57575f9350505050611cb2565b612d6181836156ad565b979650505050505050565b5f5f80516020615a7e83398151915281612d868585613bb4565b90508015611919575f8581526020839052604090206124549085613c2d565b80516001600160a01b0316612db75750565b60408101516001600160d01b031916657bb7577aaf5760d11b01612e8f57805f01516001600160a01b03166386d1a69f6040518163ffffffff1660e01b81526004015f604051808303815f87803b158015612e10575f80fd5b505af1925050508015612e21575060015b611848573d808015612e4e576040519150601f19603f3d011682016040523d82523d5f602084013e612e53565b606091505b507fd4dda53af3bad1326f8c4a3308709c8621ff0cf0691b7a3052e2fcda2f9141db81604051612e8391906156d7565b60405180910390a15050565b60408101516001600160d01b03191665b275294801e560d01b01612f535780516040516370a0823160e01b81523060048201526001600160a01b03909116906311bcc81e9082906370a0823190602401602060405180830381865afa158015612efa573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612f1e91906156c0565b6040518263ffffffff1660e01b8152600401612f3c91815260200190565b5f604051808303815f87803b158015612e10575f80fd5b604080820151905163084523c560e11b81526001600160d01b031990911660048201526024016114fa565b6001600160801b031982165f90815260096020526040812054600554600354612fb6919061ffff80871691600160c01b900416613af5565b611cb291906156ad565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261102b908490613c41565b7fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d10280546060915f80516020615a9e83398151915291613050906156e9565b80601f016020809104026020016040519081016040528092919081815260200182805461307c906156e9565b80156130c75780601f1061309e576101008083540402835291602001916130c7565b820191905f5260205f20905b8154815290600101906020018083116130aa57829003601f168201915b505050505091505090565b7fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d10380546060915f80516020615a9e83398151915291613050906156e9565b5f611cb28383613ca2565b5f831561312957505f610fef565b5f6131438461313d36869003860186615767565b90613cc8565b6001600160801b031988165f90815260086020526040812060010154600354929350909161318b9189916001600160401b03909116908590600160c01b900461ffff16613cdb565b90505f6131a7826131a136889003880188615767565b90613d1d565b9998505050505050505050565b5f610998825490565b5f61196b613d30565b5f807f4d9f77ff47b5a86f69f849f0468d24908e3c97653ee3cbecc5bb86ff0f7de941845f0151856020015186604001518760600151886080015160405160200161324f969594939291909586526001600160801b031994851660208701529290931660408501526001600160a01b03166060840152608083019190915260a082015260c00190565b604051602081830303815290604052805190602001209050611919838260405161190160f01b8152600281019290925260228201526042902090565b5f805f6132988585613da3565b5090925090505f8160038111156132b1576132b1615781565b1480156132cf5750856001600160a01b0316826001600160a01b0316145b806132e057506132e0868686613dec565b9695505050505050565b5f805f806132f88686613da3565b9250925092506133088282613ec2565b5090949350505050565b60035460801b6001600160801b03191661332f60208a018a615308565b6001600160801b0319161461334b57611f516020890189615308565b8760c00135421061337557604051630f5f3b2360e41b815260c089013560048201526024016114fa565b5f61338a846040516020016127e89190615795565b90505f613398848484613f7a565b9050600a5481146133d157600a5460405163117cd02b60e01b8152600481018490526024810183905260448101919091526064016114fa565b505f90506133f46133e7368b90038b018b61581a565b6133ef6131bd565b613fb2565b600254909150600160a81b900460ff1615801561345d575061345b61341f6040860160208701614e39565b828a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061328b92505050565b155b156134e1575f6134a2828a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152506132ea92505050565b9050806134b56040870160208801614e39565b604051631fb7a3a360e01b81526001600160a01b039283166004820152911660248201526044016114fa565b5f6135218288888080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152506132ea92505050565b905061353a5f80516020615afe83398151915282611921565b613562576040516301120d5160e31b81526001600160a01b03821660048201526024016114fa565b505f905060088161357960408c0160208d01615308565b6001600160801b0319166001600160801b03191681526020019081526020015f2090505f6135c98a60200160208101906135b39190615308565b6135c3608088016060890161533b565b5f612c0c565b9050808a6060013511156135fd576040516372b4ba4160e11b815260608b01356004820152602481018290526044016114fa565b505f61361960608b013561313d368d90038d0160808e01615767565b90505f61366661362f60408d0160208e01615308565b61363f6060890160408a0161533b565b6001600160401b031661365860a08a0160808b01614cd8565b8e606001358f60800161311b565b90508a60600135835f015f82825461367e91906154d7565b90915550506001830180548391905f906136a29084906001600160401b0316615606565b92506101000a8154816001600160401b0302191690836001600160401b031602179055508a6060013560045f8282546136db91906154d7565b925050819055508060055f8282546136f391906154d7565b90915550613709905060608c0160408d01614e39565b6001600160a01b031661372260408d0160208e01615308565b6001600160801b03191660035f9054906101000a900460801b6001600160801b0319167fddc469e1e78b774ed8fa261ecf2cb0081b304697ade1665e57a5e2d6271343758e60600135868660405161378d939291909283526020830191909152604082015260600190565b60405180910390a46137c96137a860608d0160408e01614e39565b6137b68360608f01356156ad565b6002546001600160a01b03169190612fc0565b5050505050505050505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff1661108057604051631afcd79f60e31b815260040160405180910390fd5b6138276137d6565b5f80516020615a9e8339815191527fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d10261386084826158f7565b506003810161386f83826158f7565b505f8082556001909101555050565b5f5f80516020615b1e8339815191526138978484611921565b613916575f848152602082815260408083206001600160a01b03871684529091529020805460ff191660011790556138cc3390565b6001600160a01b0316836001600160a01b0316857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a46001915050610998565b5f915050610998565b5092915050565b5f611cb2836001600160a01b0384166140d2565b5f81515f0361394a57505f919050565b61395582600161411e565b91505b6001825111156139745761396d82600161411e565b9150613958565b815f81518110613986576139866152f4565b60200260200101519050919050565b61399f8282611921565b610f1a5760405163e2517d3f60e01b81526001600160a01b0382166004820152602481018390526044016114fa565b80515f906001600160a01b03166139e657505f919050565b60208201516001600160d01b031916657bb7577aaf5760d11b01613a6757815f01516001600160a01b031663fbccedae6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613a43573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061099891906156c0565b60208201516001600160d01b03191665b275294801e560d01b01613aca5781516040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015613a43573d5f803e3d5ffd5b602082015160405163084523c560e11b81526001600160d01b031990911660048201526024016114fa565b5f838302815f1985870982811083820303915050805f03613b2957838281613b1f57613b1f6159b2565b0492505050611cb2565b808411613b495760405163227bc15360e01b815260040160405180910390fd5b5f848688095f868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b5f5f80516020615b1e833981519152613bcd8484611921565b15613916575f848152602082815260408083206001600160a01b0387168085529252808320805460ff1916905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a46001915050610998565b5f611cb2836001600160a01b0384166142be565b5f613c556001600160a01b03841683614398565b905080515f14158015613c79575080806020019051810190613c7791906159c6565b155b1561102b57604051635274afe760e01b81526001600160a01b03841660048201526024016114fa565b5f825f018281548110613cb757613cb76152f4565b905f5260205f200154905092915050565b5f611cb282845f01518560200151613af5565b5f80848611613cea575f613cf4565b613cf485876156ad565b90505f818511613d04575f613d0e565b613d0e82866156ad565b9050612d618185612710613af5565b5f611cb2828460200151855f0151613af5565b5f7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f613d5a6143a5565b613d6261440d565b60408051602081019490945283019190915260608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b5f805f8351604103613dda576020840151604085015160608601515f1a613dcc8882858561444f565b955095509550505050613de5565b505081515f91506002905b9250925092565b5f805f856001600160a01b03168585604051602401613e0c9291906159e1565b60408051601f198184030181529181526020820180516001600160e01b0316630b135d3f60e11b17905251613e4191906159f9565b5f60405180830381855afa9150503d805f8114613e79576040519150601f19603f3d011682016040523d82523d5f602084013e613e7e565b606091505b5091509150818015613e9257506020815110155b80156132e057508051630b135d3f60e11b90613eb790830160209081019084016156c0565b149695505050505050565b5f826003811115613ed557613ed5615781565b03613ede575050565b6001826003811115613ef257613ef2615781565b03613f105760405163f645eedf60e01b815260040160405180910390fd5b6002826003811115613f2457613f24615781565b03613f455760405163fce698f760e01b8152600481018290526024016114fa565b6003826003811115613f5957613f59615781565b03610f1a576040516335e2f38360e21b8152600481018290526024016114fa565b5f81815b84811015611cae57613fa882878784818110613f9c57613f9c6152f4565b90506020020135614517565b9150600101613f7e565b6080828101518051602091820151604080517f953108a3ec009aa6b52fdec87fca4e92a1dd82710c0c6e2497368614711c355f81860152808201939093526060808401929092528051808403830181529483018152845194840194909420865184880151868901519389015160a0808b01517f34a89751a0a9c434a0b09a2df0ebf72338e87f92fc423ec7b07bb6a49af0f704918801919091526001600160801b031993841660c08801529290911660e08601526001600160a01b03909316610100850152610120840192909252610140830181905261016080840192909252845180840390920182526101808301948590528151919093012061190160f01b845261018282018590526101a290910181905260429092205f9290610fef565b5f81815260018301602052604081205461411757508154600181810184555f848152602080822090930184905584548482528286019093526040902091909155610998565b505f610998565b81516060905f61412f600283615a14565b90505f61413d600284615a27565b1580159150614154578161415081615a3a565b9250505b858561419f57826001600160401b03811115614172576141726146ae565b60405190808252806020026020018201604052801561419b578160200160208202803683370190505b5090505b5f826141ab57836141b6565b6141b66001856156ad565b90505f5b818110156142445761421f896141d1836002615a52565b815181106141e1576141e16152f4565b60200260200101518a8360026141f79190615a52565b6142029060016154d7565b81518110614212576142126152f4565b6020026020010151614517565b838281518110614231576142316152f4565b60209081029190910101526001016141ba565b5082156142a9576142808861425a6001886156ad565b8151811061426a5761426a6152f4565b60200260200101518960018861420291906156ad565b8261428c6001876156ad565b8151811061429c5761429c6152f4565b6020026020010181815250505b86156142b3578382525b509695505050505050565b5f8181526001830160205260408120548015613916575f6142e06001836156ad565b85549091505f906142f3906001906156ad565b9050808214614352575f865f018281548110614311576143116152f4565b905f5260205f200154905080875f018481548110614331576143316152f4565b5f918252602080832090910192909255918252600188019052604090208390555b855486908061436357614363615a69565b600190038181905f5260205f20015f90559055856001015f8681526020019081526020015f205f905560019350505050610998565b6060611cb283835f614543565b5f5f80516020615a9e833981519152816143bd613012565b8051909150156143d557805160209091012092915050565b815480156143e4579392505050565b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470935050505090565b5f5f80516020615a9e833981519152816144256130d2565b80519091501561443d57805160209091012092915050565b600182015480156143e4579392505050565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a084111561448857505f9150600390508261450d565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa1580156144d9573d5f803e3d5ffd5b5050604051601f1901519150506001600160a01b03811661450457505f92506001915082905061450d565b92505f91508190505b9450945094915050565b5f818310614531575f828152602084905260409020611cb2565b5f838152602083905260409020611cb2565b6060814710156145685760405163cd78605960e01b81523060048201526024016114fa565b5f80856001600160a01b0316848660405161458391906159f9565b5f6040518083038185875af1925050503d805f81146145bd576040519150601f19603f3d011682016040523d82523d5f602084013e6145c2565b606091505b50915091506132e08683836060826145e2576145dd82614629565b611cb2565b81511580156145f957506001600160a01b0384163b155b1561462257604051639996b31560e01b81526001600160a01b03851660048201526024016114fa565b5080611cb2565b8051156146395780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b5080545f825560010160029004905f5260205f209081019061184891905b80821115614683575f8155600101614670565b5090565b5f60208284031215614697575f80fd5b81356001600160e01b031981168114611cb2575f80fd5b634e487b7160e01b5f52604160045260245ffd5b604051606081016001600160401b03811182821017156146e4576146e46146ae565b60405290565b60405160a081016001600160401b03811182821017156146e4576146e46146ae565b6040516101c081016001600160401b03811182821017156146e4576146e46146ae565b604051601f8201601f191681016001600160401b0381118282101715614757576147576146ae565b604052919050565b6001600160a01b0381168114611848575f80fd5b803561477e8161475f565b919050565b80356001600160801b03198116811461477e575f80fd5b6001600160d01b031981168114611848575f80fd5b5f606082840312156147bf575f80fd5b6147c76146c2565b905081356147d48161475f565b815260208201356147e48161479a565b602082015260408201356147f78161479a565b604082015292915050565b5f6001600160401b0382111561481a5761481a6146ae565b5060051b60200190565b6001600160401b0381168114611848575f80fd5b8015158114611848575f80fd5b5f60a08284031215614855575f80fd5b61485d6146ea565b905061486882614783565b815260208201356148788161475f565b6020820152604082013561488b81614824565b6040820152606082013561489e81614824565b606082015260808201356148b181614838565b608082015292915050565b5f82601f8301126148cb575f80fd5b813560206148e06148db83614802565b61472f565b8083825260208201915060a0602060a08602880101945087851115614903575f80fd5b602087015b858110156149275761491a8982614845565b8452928401928101614908565b5090979650505050505050565b803561ffff8116811461477e575f80fd5b5f60608284031215614955575f80fd5b61495d6146c2565b905061496882614783565b815260208201356149788161475f565b60208201526147f760408301614934565b5f82601f830112614998575f80fd5b813560206149a86148db83614802565b8083825260208201915060606020606086028801019450878511156149cb575f80fd5b602087015b85811015614927576149e28982614945565b84529284019281016149d0565b5f602082840312156149ff575f80fd5b81356001600160401b0380821115614a15575f80fd5b908301906102008286031215614a29575f80fd5b614a3161470c565b614a3a83614773565b8152614a4860208401614783565b6020820152614a5a86604085016147af565b6040820152614a6b60a08401614773565b606082015260c083013582811115614a81575f80fd5b614a8d878286016148bc565b60808301525060e083013582811115614aa4575f80fd5b614ab087828601614989565b60a0830152506101009150614ac6828401614773565b60c0820152610120614ad9818501614773565b60e0830152610140614aec818601614773565b848401526101609350614b00848601614773565b828401526101809150614b14828601614773565b908301526101a0614b26858201614773565b848401526101c085013582840152614b416101e08601614934565b908301525095945050505050565b5f60208284031215614b5f575f80fd5b5035919050565b5f8083601f840112614b76575f80fd5b5081356001600160401b03811115614b8c575f80fd5b6020830191508360208260051b8501011115614ba6575f80fd5b9250929050565b5f8060208385031215614bbe575f80fd5b82356001600160401b03811115614bd3575f80fd5b614bdf85828601614b66565b90969095509350505050565b5f815180845260208085019450602084015f5b83811015614c1a57815187529582019590820190600101614bfe565b509495945050505050565b602081525f611cb26020830184614beb565b5f8060408385031215614c48575f80fd5b823591506020830135614c5a8161475f565b809150509250929050565b5f805f60408486031215614c77575f80fd5b83356001600160401b0380821115614c8d575f80fd5b818601915086601f830112614ca0575f80fd5b813581811115614cae575f80fd5b87602060a083028501011115614cc2575f80fd5b6020928301989097509590910135949350505050565b5f60208284031215614ce8575f80fd5b8135611cb281614838565b5f805f805f60608688031215614d07575f80fd5b85356001600160401b0380821115614d1d575f80fd5b614d2989838a01614b66565b90975095506020880135915080821115614d41575f80fd5b50614d4e88828901614b66565b9094509250506040860135614d6281614838565b809150509295509295909350565b5f8083601f840112614d80575f80fd5b5081356001600160401b03811115614d96575f80fd5b602083019150836020606083028501011115614ba6575f80fd5b5f8060208385031215614dc1575f80fd5b82356001600160401b03811115614dd6575f80fd5b614bdf85828601614d70565b602080825282518282018190525f919060409081850190868401855b82811015614e2c578151805185528601516001600160401b0316868501529284019290850190600101614dfe565b5091979650505050505050565b5f60208284031215614e49575f80fd5b8135611cb28161475f565b5f805f60608486031215614e66575f80fd5b8335614e718161475f565b92506020840135614e818161475f565b929592945050506040919091013590565b5f60608284031215614ea2575f80fd5b50919050565b602080825282518282018190525f919060409081850190868401855b82811015614e2c57815180516001600160a01b0316855286015161ffff16868501529284019290850190600101614ec4565b5f5b83811015614f10578181015183820152602001614ef8565b50505f910152565b5f8151808452614f2f816020860160208601614ef6565b601f01601f19169290920160200192915050565b60ff60f81b8816815260e060208201525f614f6160e0830189614f18565b8281036040840152614f738189614f18565b606084018890526001600160a01b038716608085015260a0840186905283810360c08501529050614fa48185614beb565b9a9950505050505050505050565b5f8060408385031215614fc3575f80fd5b50508035926020909101359150565b602080825282518282018190525f9190848201906040850190845b818110156150135783516001600160801b03191683529284019291840191600101614fed565b50909695505050505050565b5f805f60608486031215615031575f80fd5b505081359360208301359350604090920135919050565b5f805f838503606081121561505b575f80fd5b84356001600160401b0380821115615071575f80fd5b818701915087601f830112615084575f80fd5b813581811115615092575f80fd5b8860208260071b85010111156150a6575f80fd5b6020929092019550909350506040601f19820112156150c3575f80fd5b506020840190509250925092565b5f602082840312156150e1575f80fd5b611cb282614934565b5f80602083850312156150fb575f80fd5b82356001600160401b0380821115615111575f80fd5b818501915085601f830112615124575f80fd5b813581811115615132575f80fd5b8660208260061b8501011115615146575f80fd5b60209290920196919550909350505050565b5f60a08284031215614ea2575f80fd5b5f8083601f840112615178575f80fd5b5081356001600160401b0381111561518e575f80fd5b602083019150836020828501011115614ba6575f80fd5b5f805f805f60e086880312156151b9575f80fd5b6151c38787615158565b945060a08601356001600160401b03808211156151de575f80fd5b6151ea89838a01615168565b909650945060c0880135915080821115615202575f80fd5b5061520f88828901615168565b969995985093965092949392505050565b5f805f805f805f805f898b0361020081121561523a575f80fd5b60e0811215615247575f80fd5b5089985060e08a01356001600160401b0380821115615264575f80fd5b6152708d838e01615168565b909a5098506101008c0135915080821115615289575f80fd5b6152958d838e01615168565b90985096508691506152ab8d6101208e01615158565b95506101c08c01359150808211156152c1575f80fd5b506152ce8c828d01614b66565b9094509250506101e08a01356152e381614838565b809150509295985092959850929598565b634e487b7160e01b5f52603260045260245ffd5b5f60208284031215615318575f80fd5b611cb282614783565b5f60a08284031215615331575f80fd5b611cb28383614845565b5f6020828403121561534b575f80fd5b8135611cb281614824565b5f60608284031215615366575f80fd5b611cb28383614945565b5f60608284031215615380575f80fd5b611cb283836147af565b81356153958161475f565b81546001600160a01b031981166001600160a01b0392909216918217835560208401356153c18161479a565b65ffffffffffff60a01b60309190911c166001600160d01b03199182168317811784556040850135916153f38361479a565b9217911617905550565b60608101823561540c8161475f565b6001600160a01b0316825260208301356154258161479a565b6001600160d01b031990811660208401526040840135906154458261479a565b8082166040850152505092915050565b60408152602460408201527f736574556e6c6f636b65722828616464726573732c6279746573362c627974656060820152637336292960e01b608082015260a060208201525f611cb260a0830184614f18565b5f602082840312156154b8575f80fd5b8151611cb28161475f565b634e487b7160e01b5f52601160045260245ffd5b80820180821115610998576109986154c3565b8135815560018101602083013561550081614824565b815467ffffffffffffffff19166001600160401b03919091161790555050565b61ffff82811682821603908082111561391f5761391f6154c3565b61ffff81811683821601908082111561391f5761391f6154c3565b5f60a08284031215615566575f80fd5b61556e6146ea565b61557783614783565b815261558560208401614783565b602082015260408301356155988161475f565b6040820152606083810135908201526080928301359281019290925250919050565b6020808252602c908201527f656e74697479555549442063616e6e6f742062652074686520706c6174666f7260408201526b1b48195b9d1a5d1e5555525160a21b606082015260800190565b6001600160401b0381811683821601908082111561391f5761391f6154c3565b606080825284519082018190525f906020906080840190828801845b8281101561565e57815184529284019290840190600101615642565b5050506020840195909552505060400152919050565b60408152601060408201526f736574456e61626c656428626f6f6c2960801b6060820152608060208201525f611cb26080830184614f18565b81810381811115610998576109986154c3565b5f602082840312156156d0575f80fd5b5051919050565b602081525f611cb26020830184614f18565b600181811c908216806156fd57607f821691505b602082108103614ea257634e487b7160e01b5f52602260045260245ffd5b5f6040828403121561572b575f80fd5b604051604081018181106001600160401b038211171561574d5761574d6146ae565b604052823581526020928301359281019290925250919050565b5f60408284031215615777575f80fd5b611cb2838361571b565b634e487b7160e01b5f52602160045260245ffd5b60a081016001600160801b03196157ab84614783565b16825260208301356157bc8161475f565b6001600160a01b0316602083015260408301356157d881614824565b6001600160401b0390811660408401526060840135906157f782614824565b166060830152608083013561580b81614838565b80151560808401525092915050565b5f60e0828403121561582a575f80fd5b60405160c081018181106001600160401b038211171561584c5761584c6146ae565b60405261585883614783565b815261586660208401614783565b602082015260408301356158798161475f565b604082015260608381013590820152615895846080850161571b565b608082015260c0929092013560a083015250919050565b601f82111561102b57805f5260205f20601f840160051c810160208510156158d15750805b601f840160051c820191505b818110156158f0575f81556001016158dd565b5050505050565b81516001600160401b03811115615910576159106146ae565b6159248161591e84546156e9565b846158ac565b602080601f831160018114615957575f84156159405750858301515b5f19600386901b1c1916600185901b178555610d74565b5f85815260208120601f198616915b8281101561598557888601518255948401946001909101908401615966565b50858210156159a257878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b5f52601260045260245ffd5b5f602082840312156159d6575f80fd5b8151611cb281614838565b828152604060208201525f6119196040830184614f18565b5f8251615a0a818460208701614ef6565b9190910192915050565b5f82615a2257615a226159b2565b500490565b5f82615a3557615a356159b2565b500690565b5f60018201615a4b57615a4b6154c3565b5060010190565b8082028115828204841417610998576109986154c3565b634e487b7160e01b5f52603160045260245ffdfec1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e82371705932000a16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d100241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08eb80ee6ccad1a05bacb615631c5c657518a93babef3d070b1c2aa8d8f2d00cbfe2f4eaae4a9751e85a3e4a7b9587827a877f29914755229b07a7b2da98285f7002dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b62680063d8e56f0160910d57b83f54cac0b3871607c2529985aa50e353236389f5accaf0d6c3c8ca089b9e67e712dd7b15ff94395328b650078948c3ebdde284f94f6ea2646970667358221220fc04dead98cb336a1645e8b42e60d41ced52eddedc06035d0527211c7d076f3c64736f6c63430008170033

Deployed Bytecode

0x608060405234801561000f575f80fd5b5060043610610392575f3560e01c80638456cb59116101df578063b82538bd11610109578063e2ca5974116100a9578063f83f55a911610079578063f83f55a914610927578063fc0c546a1461093b578063fdf25f331461094e578063ff3c2f8914610961575f80fd5b8063e2ca5974146108d1578063e63ab1e9146108e4578063ec87621c1461090b578063f698da251461091f575f80fd5b8063cf055d5c116100e4578063cf055d5c1461088d578063d547741f146108a1578063d54ad2a1146108b4578063e00549ab146108bd575f80fd5b8063b82538bd14610841578063c824166f14610867578063ca15c8731461087a575f80fd5b8063a217fddf1161017f578063ae2560af1161014f578063ae2560af146107d6578063b212f067146107e9578063b3061b911461081b578063b6870c5a1461082e575f80fd5b8063a217fddf1461078a578063a377052314610791578063a8981e731461079a578063a8fc9e29146107af575f80fd5b80639010d07c116101ba5780639010d07c1461074857806391d148541461075b5780639dc69e1f1461076e578063a1ebf35d14610776575f80fd5b80638456cb591461071c57806384b0196e146107245780638f22602e1461073f575f80fd5b80633f953f9a116102c05780635f3e849f116102605780636adc3168116102305780636adc31681461069357806370824c5c146106c257806373852d27146106e95780638164183e14610709575f80fd5b80635f3e849f14610646578063601ed31b14610659578063652cce511461066c5780636aa633b61461067f575f80fd5b80634407390d1161029b5780634407390d146105865780634925abac1461059957806354fd4d50146105ac57806358941f1e14610633575f80fd5b80633f953f9a1461054a57806340b40f551461055d5780634111bf9d1461057d575f80fd5b806326e670ea11610336578063342cf27a11610306578063342cf27a1461050757806336568abe1461051a5780633ba930ad1461052d5780633d24f8f714610542575f80fd5b806326e670ea146104ae5780632f2ff15d146104ce5780632fc2ec02146104e1578063328d8f72146104f4575f80fd5b806319a1e5871161037157806319a1e5871461042d57806320ab083e146104415780632257310f1461046c578063248a9ca31461048d575f80fd5b80620769431461039657806301ffc9a7146103f5578063052548e914610418575b5f80fd5b5f546103c0906001600160a01b03811690600160a01b810460d090811b91600160d01b9004901b83565b604080516001600160a01b0390941684526001600160d01b031992831660208501529116908201526060015b60405180910390f35b610408610403366004614687565b610974565b60405190151581526020016103ec565b61042b6104263660046149ef565b61099e565b005b60025461040890600160a81b900460ff1681565b600154610454906001600160a01b031681565b6040516001600160a01b0390911681526020016103ec565b60075461047a9061ffff1681565b60405161ffff90911681526020016103ec565b6104a061049b366004614b4f565b610d7c565b6040519081526020016103ec565b6104c16104bc366004614bad565b610d9c565b6040516103ec9190614c25565b61042b6104dc366004614c37565b610e66565b61042b6104ef366004614c65565b610e88565b61042b610502366004614cd8565b610efa565b6104c1610515366004614cf3565b610f1e565b61042b610528366004614c37565b610ff8565b60035461047a90600160c01b900461ffff1681565b61042b611030565b61042b610558366004614db0565b611082565b61057061056b366004614bad565b6110f3565b6040516103ec9190614de2565b6104a0600a5481565b61042b610594366004614e39565b6111ec565b6104c16105a7366004614bad565b611226565b6040805163ffffffff7f0000000000000000000000000000000000000000000000000000000000000002811682527f0000000000000000000000000000000000000000000000000000000000000000811660208301527f000000000000000000000000000000000000000000000000000000000000000016918101919091526060016103ec565b61042b610641366004614cd8565b61131a565b61042b610654366004614e54565b611350565b61042b610667366004614e92565b61137b565b61042b61067a366004614b4f565b611419565b60025461040890600160a01b900460ff1681565b5f805260096020527fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b546104a0565b6104a07f797343f8d6a29aafeb3aaf0910a8973e0081c60c2f6c1f775cd9f76ea348fc1e81565b6106fc6106f7366004614bad565b6115cc565b6040516103ec9190614ea8565b61042b610717366004614db0565b6116cc565b61042b611815565b61072c61184b565b6040516103ec9796959493929190614f43565b6104a060065481565b610454610756366004614fb2565b6118f4565b610408610769366004614c37565b611921565b6104a0611957565b6104a05f80516020615afe83398151915281565b6104a05f81565b6104a060055481565b6107a2611970565b6040516103ec9190614fd2565b6104a07faeaff0ba5714de3101330cd09333f32afb2556d1f0ec0469ef94ffe1e27c4bca81565b6104c16107e4366004614bad565b6119f2565b60035461080390600160801b90046001600160401b031681565b6040516001600160401b0390911681526020016103ec565b61042b61082936600461501f565b611aae565b6104c161083c366004615048565b611b8e565b60035461084e9060801b81565b6040516001600160801b031990911681526020016103ec565b61042b6108753660046150d1565b611cb9565b6104a0610888366004614b4f565b611d9a565b6104a05f80516020615ade83398151915281565b61042b6108af366004614c37565b611dbe565b6104a060045481565b6104a05f80516020615b5e83398151915281565b61042b6108df3660046150ea565b611dda565b6104a07f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a81565b6104a05f80516020615abe83398151915281565b6104a0611ee4565b6104a05f80516020615b3e83398151915281565b600254610454906001600160a01b031681565b61042b61095c3660046151a5565b611eed565b61042b61096f366004615220565b612318565b5f6001600160e01b03198216635a05180f60e01b148061099857506109988261236d565b92915050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff1615906001600160401b03165f811580156109e25750825b90505f826001600160401b031660011480156109fd5750303b155b905081158015610a0b575080155b15610a295760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff191660011785558315610a5357845460ff60401b1916600160401b1785555b610a5b6123a1565b610aa16040518060400160405280600b81526020016a2234b9ba3934b13aba37b960a91b815250604051806040016040528060018152602001603160f81b8152506123a9565b610ad85f80516020615b3e8339815191527faeaff0ba5714de3101330cd09333f32afb2556d1f0ec0469ef94ffe1e27c4bca6123bb565b610afc5f80516020615afe8339815191525f80516020615b3e8339815191526123bb565b610b205f80516020615ade8339815191525f80516020615b3e8339815191526123bb565b610b305f801b8760c0015161241b565b50610b4c5f80516020615abe8339815191528760e0015161241b565b50610b7c7faeaff0ba5714de3101330cd09333f32afb2556d1f0ec0469ef94ffe1e27c4bca87610100015161241b565b50610b995f80516020615b3e83398151915287610120015161241b565b50610bb65f80516020615afe83398151915287610140015161241b565b50610bd35f80516020615ade83398151915287610160015161241b565b50610c037f797343f8d6a29aafeb3aaf0910a8973e0081c60c2f6c1f775cd9f76ea348fc1e87610160015161241b565b50610c337f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a87610160015161241b565b50610c41866040015161245d565b60408681015180515f805460208085015194909501516001600160a01b039384166001600160d01b031990921691909117600160a01b60d095861c02176001600160d01b0316600160d01b9190941c02929092179091556060880151600180546001600160a01b03199081169284169290921790558851600280549092169216919091179055860151600380546001600160801b031916608092831c1790556101a08701516007805461ffff191661ffff909216919091179055860151610180870151610d0e91906125d4565b610d1b8660a0015161288e565b6002805460ff60a01b1916600160a01b1790558315610d7457845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b505050505050565b5f9081525f80516020615b1e833981519152602052604090206001015490565b60605f826001600160401b03811115610db757610db76146ae565b604051908082528060200260200182016040528015610de0578160200160208202803683370190505b5090505f5b83811015610e5e5760095f868684818110610e0257610e026152f4565b9050602002016020810190610e179190615308565b6001600160801b0319166001600160801b03191681526020019081526020015f2054828281518110610e4b57610e4b6152f4565b6020908102919091010152600101610de5565b509392505050565b610e6f82610d7c565b610e7881612b82565b610e82838361241b565b50505050565b5f80516020615abe833981519152610e9f81612b82565b610e828484808060200260200160405190810160405280939291908181526020015f905b82821015610eef57610ee060a08302860136819003810190615321565b81526020019060010190610ec3565b5050505050836125d4565b5f80516020615b3e833981519152610f1181612b82565b610f1a82612b8c565b5050565b60605f856001600160401b03811115610f3957610f396146ae565b604051908082528060200260200182016040528015610f62578160200160208202803683370190505b5090505f5b86811015610feb57610fc6888883818110610f8457610f846152f4565b9050602002016020810190610f999190615308565b878784818110610fab57610fab6152f4565b9050602002016020810190610fc0919061533b565b86612c0c565b828281518110610fd857610fd86152f4565b6020908102919091010152600101610f67565b5090505b95945050505050565b6001600160a01b03811633146110215760405163334bd91960e11b815260040160405180910390fd5b61102b8282612d6c565b505050565b604080516060810182525f546001600160a01b03811682526001600160d01b0319600160a01b820460d090811b82166020850152600160d01b90920490911b169181019190915261108090612da5565b565b5f80516020615abe83398151915261109981612b82565b61102b8383808060200260200160405190810160405280939291908181526020015f905b828210156110e9576110da60608302860136819003810190615356565b815260200190600101906110bd565b505050505061288e565b60605f826001600160401b0381111561110e5761110e6146ae565b60405190808252806020026020018201604052801561115257816020015b604080518082019091525f808252602082015281526020019060019003908161112c5790505b5090505f5b83811015610e5e5760085f868684818110611174576111746152f4565b90506020020160208101906111899190615308565b6001600160801b031916815260208082019290925260409081015f20815180830190925280548252600101546001600160401b03169181019190915282518390839081106111d9576111d96152f4565b6020908102919091010152600101611157565b5f80516020615abe83398151915261120381612b82565b50600180546001600160a01b0319166001600160a01b0392909216919091179055565b60605f826001600160401b03811115611241576112416146ae565b60405190808252806020026020018201604052801561126a578160200160208202803683370190505b5090505f5b83811015610e5e576112f585858381811061128c5761128c6152f4565b90506020020160208101906112a19190615308565b600b5f8888868181106112b6576112b66152f4565b90506020020160208101906112cb9190615308565b6001600160801b031916815260208101919091526040015f2054600160a01b900461ffff16612f7e565b828281518110611307576113076152f4565b602090810291909101015260010161126f565b5f80516020615abe83398151915261133181612b82565b5060028054911515600160a81b0260ff60a81b19909216919091179055565b5f80516020615abe83398151915261136781612b82565b610e826001600160a01b0385168484612fc0565b5f80516020615b3e83398151915261139281612b82565b6113a96113a436849003840184615370565b61245d565b815f6113b5828261538a565b505060405163601ed31b60e01b907f11f2fec7a1604d7d8ea8b74ed1666060410561f7e666aee037dcf3f9292cb4c1906113f39085906020016153fd565b60408051601f198184030181529082905261140d91615455565b60405180910390a25050565b5f80516020615ade83398151915261143081612b82565b600154604051639d84ae6960e01b81527f35bd7c3085200665404055ee8facd7c7cf131f375247edf256b95933d81b07b460048201525f916001600160a01b031690639d84ae6990602401602060405180830381865afa158015611496573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114ba91906154a8565b6007549091505f906114d190829061ffff16612f7e565b90508084111561150357604051630f4da97960e41b815260048101859052602481018290526044015b60405180910390fd5b5f80805260096020527fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b805486929061153d9084906154d7565b925050819055508360065f82825461155591906154d7565b90915550506003546040516001600160a01b038416915f9160809190911b6001600160801b031916907f7ed4454676b40d92244b47fc7a6ef3aab0808cbf85d84fc65676a040343d4823906115ad9089815260200190565b60405180910390a4600254610e82906001600160a01b03168386612fc0565b60605f826001600160401b038111156115e7576115e76146ae565b60405190808252806020026020018201604052801561162b57816020015b604080518082019091525f80825260208201528152602001906001900390816116055790505b5090505f5b83811015610e5e57600b5f86868481811061164d5761164d6152f4565b90506020020160208101906116629190615308565b6001600160801b031916815260208082019290925260409081015f208151808301909252546001600160a01b0381168252600160a01b900461ffff169181019190915282518390839081106116b9576116b96152f4565b6020908102919091010152600101611630565b5f80516020615b5e8339815191526116e381612b82565b6004545f5b8381101561180c575f858583818110611703576117036152f4565b6117199260206060909202019081019150615308565b90503686868481811061172e5761172e6152f4565b90506060020160200190505f81602001602081019061174d919061533b565b6001600160401b03161115155f825f01351115151461178b576040516329a440e160e01b81526001600160801b0319831660048201526024016114fa565b6001600160801b031982165f90815260086020526040902054156117ce5760405163536c104560e11b81526001600160801b0319831660048201526024016114fa565b6001600160801b031982165f90815260086020526040902081906117f282826154ea565b5061180090508135856154d7565b935050506001016116e8565b50600455505050565b7f65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a61183f81612b82565b6118485f612b8c565b50565b5f60608082808083815f80516020615a9e833981519152805490915015801561187657506001810154155b6118ba5760405162461bcd60e51b81526020600482015260156024820152741152540dcc4c8e88155b9a5b9a5d1a585b1a5e9959605a1b60448201526064016114fa565b6118c2613012565b6118ca6130d2565b604080515f80825260208201909252600f60f81b9c939b5091995046985030975095509350915050565b5f8281525f80516020615a7e8339815191526020819052604082206119199084613110565b949350505050565b5f9182525f80516020615b1e833981519152602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6007545f9061196b90829061ffff16612f7e565b905090565b6060600c8054806020026020016040519081016040528092919081815260200182805480156119e857602002820191905f5260205f20905f905b82829054906101000a900460801b6001600160801b03191681526020019060100190602082600f010492830192600103820291508084116119aa5790505b5050505050905090565b60605f826001600160401b03811115611a0d57611a0d6146ae565b604051908082528060200260200182016040528015611a36578160200160208202803683370190505b5090505f5b83811015610e5e5760085f868684818110611a5857611a586152f4565b9050602002016020810190611a6d9190615308565b6001600160801b031916815260208101919091526040015f20548251839083908110611a9b57611a9b6152f4565b6020908102919091010152600101611a3b565b5f80516020615b5e833981519152611ac581612b82565b60058490556004548314611b1d57600480546040516315d3fa8760e01b8152606092810192909252600c60648301526b1d1bdd185b10db185a5b595960a21b608483015260248201526044810184905260a4016114fa565b8160065414611b77576006546040516315d3fa8760e01b81526060600482015260136064820152723a37ba30b621b0b9393cabb4ba34323930bbb760691b608482015260248101919091526044810183905260a4016114fa565b610e825f80516020615b5e83398151915233610ff8565b60605f836001600160401b03811115611ba957611ba96146ae565b604051908082528060200260200182016040528015611bd2578160200160208202803683370190505b5090505f5b84811015611cae57611c89868683818110611bf457611bf46152f4565b611c0a9260206080909202019081019150615308565b878784818110611c1c57611c1c6152f4565b9050608002016020016020810190611c34919061533b565b6001600160401b0316888885818110611c4f57611c4f6152f4565b9050608002016040016020810190611c679190614cd8565b898986818110611c7957611c796152f4565b905060800201606001358861311b565b828281518110611c9b57611c9b6152f4565b6020908102919091010152600101611bd7565b5090505b9392505050565b5f80516020615abe833981519152611cd081612b82565b6107d08261ffff161115611d3d576040516301f6ffb960e31b815260206004820152602d60248201527f506c6174666f726d206361727279204250532063616e6e6f742062652067726560448201526c61746572207468616e2032302560981b60648201526084016114fa565b6007546003548391611d5e9161ffff91821691600160c01b90910416615520565b611d68919061553b565b6003805461ffff60c01b1916600160c01b61ffff938416021790556007805461ffff1916939091169290921790915550565b5f8181525f80516020615a7e833981519152602081905260408220611cb2906131b4565b611dc782610d7c565b611dd081612b82565b610e828383612d6c565b5f80516020615b5e833981519152611df181612b82565b6006545f5b83811015611edb575f858583818110611e1157611e116152f4565b611e279260206040909202019081019150615308565b6001600160801b031981165f9081526009602052604090205490915015611e6d576040516315adf33960e21b81526001600160801b0319821660048201526024016114fa565b858583818110611e7f57611e7f6152f4565b6001600160801b031984165f908152600960209081526040918290209190920293909301013590915550858583818110611ebb57611ebb6152f4565b9050604002016020013583611ed091906154d7565b925050600101611df6565b50600655505050565b5f61196b6131bd565b600254600160a01b900460ff1680611f1857604051633ac4266d60e11b815260040160405180910390fd5b60035460801b6001600160801b031916611f356020880188615308565b6001600160801b03191614611f8857611f516020870187615308565b6003546040516308d9a7fb60e41b81526114fa929160801b906004016001600160801b031992831681529116602082015260400190565b85608001354210611fb257604051630f5f3b2360e41b8152608087013560048201526024016114fa565b5f600b81611fc660408a0160208b01615308565b6001600160801b031916815260208082019290925260409081015f208151808301909252546001600160a01b038116808352600160a01b90910461ffff1692820192909252915061202a57604051637d469caf60e11b815260040160405180910390fd5b5f61204a61203d368a90038a018a615556565b6120456131bd565b6131c6565b600254909150600160a81b900460ff161580156120a757506120a5825f01518289898080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061328b92505050565b155b1561211e575f6120ec8289898080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152506132ea92505050565b8351604051631fb7a3a360e01b81526001600160a01b03808416600483015290911660248201529091506044016114fa565b5f61215e8287878080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152506132ea92505050565b90506121775f80516020615afe83398151915282611921565b61219f576040516301120d5160e31b81526001600160a01b03821660048201526024016114fa565b505f90506121c06121b660408a0160208b01615308565b8360200151612f7e565b905080886060013511156121f457604051630f4da97960e41b815260608901356004820152602481018290526044016114fa565b50606087013560095f61220d60408b0160208c01615308565b6001600160801b0319166001600160801b03191681526020019081526020015f205f82825461223c91906154d7565b92505081905550866060013560065f82825461225891906154d7565b9091555061226e90506060880160408901614e39565b6001600160a01b03166122876040890160208a01615308565b6001600160801b03191661229e60208a018a615308565b6001600160801b0319167f7ed4454676b40d92244b47fc7a6ef3aab0808cbf85d84fc65676a040343d48238a606001356040516122dd91815260200190565b60405180910390a461230f6122f86060890160408a01614e39565b6002546001600160a01b03169060608a0135612fc0565b50505050505050565b600254600160a01b900460ff168061234357604051633ac4266d60e11b815260040160405180910390fd5b811561235157612351611030565b6123618a8a8a8a8a8a8a8a613312565b50505050505050505050565b5f6001600160e01b03198216637965db0b60e01b148061099857506301ffc9a760e01b6001600160e01b0319831614610998565b6110806137d6565b6123b16137d6565b610f1a828261381f565b5f80516020615b1e8339815191525f6123d384610d7c565b5f85815260208490526040808220600101869055519192508491839187917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a450505050565b5f5f80516020615a7e83398151915281612435858561387e565b90508015611919575f8581526020839052604090206124549085613926565b50949350505050565b80516001600160a01b03166124f85760208101516001600160d01b031916151580612495575060408101516001600160d01b03191615155b1561184857604051632e3505a960e01b815260206004820152602c60248201527f756e6c6f636b657220697320756e736574206275742066756e6374696f6e207460448201526b1e5c195cc8185c99481cd95d60a21b60648201526084016114fa565b60208101516001600160d01b031916650448a88550a960d11b14801590612536575060208101516001600160d01b031916654d8ad6b7fe1b60d01b14155b1561256657602081015160405163084523c560e11b81526001600160d01b031990911660048201526024016114fa565b60408101516001600160d01b031916650448a88550a960d11b148015906125a4575060408101516001600160d01b031916654d8ad6b7fe1b60d01b14155b1561184857604080820151905163084523c560e11b81526001600160d01b031990911660048201526024016114fa565b5f8083516001600160401b038111156125ef576125ef6146ae565b604051908082528060200260200182016040528015612618578160200160208202803683370190505b5090505f5b845181101561282d575f858281518110612639576126396152f4565b602090810291909101015180519091506001600160801b031916612670576040516301f6ffb960e31b81526004016114fa906155ba565b60208101516001600160a01b03166126bc576040516301f6ffb960e31b815260206004820152600e60248201526d7369676e6572206973207a65726f60901b60448201526064016114fa565b80604001516001600160401b03165f03612719576040516301f6ffb960e31b815260206004820152601760248201527f616d6f756e7420696e766573746564206973207a65726f00000000000000000060448201526064016114fa565b80606001516001600160401b03165f03612776576040516301f6ffb960e31b815260206004820152601a60248201527f646973747269627574696f6e536861726573206973207a65726f00000000000060448201526064016114fa565b60608101516127859085615606565b6040805183516001600160801b0319166020808301919091528401516001600160a01b031681830152908301516001600160401b0390811660608084019190915284015116608080830191909152830151151560a08201529094506128079060c0015b60405160208183030381529060405280516020918201205f9081522090565b838381518110612819576128196152f4565b60209081029190910101525060010161261d565b506003805467ffffffffffffffff60801b1916600160801b6001600160401b038516021790555f61285d8261393a565b9050838114612885578181856040516316af695b60e11b81526004016114fa93929190615626565b600a5550505050565b600c548015612910575f5b8181101561290457600b5f600c83815481106128b7576128b76152f4565b5f918252602080832060028304015460019283166010026101000a900460801b6001600160801b03191684528301939093526040909101902080546001600160b01b031916905501612899565b50612910600c5f614652565b5f805b8351811015612b4f575f84828151811061292f5761292f6152f4565b602090810291909101015180519091506001600160801b031916612966576040516301f6ffb960e31b81526004016114fa906155ba565b60208101516001600160a01b03166129b2576040516301f6ffb960e31b815260206004820152600e60248201526d7369676e6572206973207a65726f60901b60448201526064016114fa565b806040015161ffff165f036129fe576040516301f6ffb960e31b8152602060048201526011602482015270636172727920425053206973207a65726f60781b60448201526064016114fa565b80516001600160801b0319165f908152600b60205260409020546001600160a01b031615612a6f576040516301f6ffb960e31b815260206004820152601960248201527f656e746974795555494420616c7265616479206578697374730000000000000060448201526064016114fa565b6040810151612a7e908461553b565b8151600c8054600180820183555f9283527fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c7600283040180546001600160801b039383166010026101000a938402191660809590951c929092029390931790556040805180820182526020808701516001600160a01b0390811683528388015161ffff90811683850190815298516001600160801b0319168652600b9092529290932090518154965192166001600160b01b031990961695909517600160a01b919092160217909255925001612913565b50600754612b619061ffff168261553b565b600360186101000a81548161ffff021916908361ffff160217905550505050565b6118488133613995565b60028054821515600160a01b0260ff60a01b19909116179055604051631946c7b960e11b907f11f2fec7a1604d7d8ea8b74ed1666060410561f7e666aee037dcf3f9292cb4c190612be7908490602001901515815260200190565b60408051601f1981840301815290829052612c0191615674565b60405180910390a250565b5f80600654600554600454612c2191906156ad565b6002546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015612c67573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612c8b91906156c0565b612c9591906154d7565b612c9f91906154d7565b90508215612d0457604080516060810182525f546001600160a01b03811682526001600160d01b0319600160a01b820460d090811b82166020850152600160d01b90920490911b1691810191909152612cf7906139ce565b612d0190826154d7565b90505b6003545f90612d289083906001600160401b0380891691600160801b900416613af5565b6001600160801b031987165f9081526008602052604090205490915080821015612d57575f9350505050611cb2565b612d6181836156ad565b979650505050505050565b5f5f80516020615a7e83398151915281612d868585613bb4565b90508015611919575f8581526020839052604090206124549085613c2d565b80516001600160a01b0316612db75750565b60408101516001600160d01b031916657bb7577aaf5760d11b01612e8f57805f01516001600160a01b03166386d1a69f6040518163ffffffff1660e01b81526004015f604051808303815f87803b158015612e10575f80fd5b505af1925050508015612e21575060015b611848573d808015612e4e576040519150601f19603f3d011682016040523d82523d5f602084013e612e53565b606091505b507fd4dda53af3bad1326f8c4a3308709c8621ff0cf0691b7a3052e2fcda2f9141db81604051612e8391906156d7565b60405180910390a15050565b60408101516001600160d01b03191665b275294801e560d01b01612f535780516040516370a0823160e01b81523060048201526001600160a01b03909116906311bcc81e9082906370a0823190602401602060405180830381865afa158015612efa573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612f1e91906156c0565b6040518263ffffffff1660e01b8152600401612f3c91815260200190565b5f604051808303815f87803b158015612e10575f80fd5b604080820151905163084523c560e11b81526001600160d01b031990911660048201526024016114fa565b6001600160801b031982165f90815260096020526040812054600554600354612fb6919061ffff80871691600160c01b900416613af5565b611cb291906156ad565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b17905261102b908490613c41565b7fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d10280546060915f80516020615a9e83398151915291613050906156e9565b80601f016020809104026020016040519081016040528092919081815260200182805461307c906156e9565b80156130c75780601f1061309e576101008083540402835291602001916130c7565b820191905f5260205f20905b8154815290600101906020018083116130aa57829003601f168201915b505050505091505090565b7fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d10380546060915f80516020615a9e83398151915291613050906156e9565b5f611cb28383613ca2565b5f831561312957505f610fef565b5f6131438461313d36869003860186615767565b90613cc8565b6001600160801b031988165f90815260086020526040812060010154600354929350909161318b9189916001600160401b03909116908590600160c01b900461ffff16613cdb565b90505f6131a7826131a136889003880188615767565b90613d1d565b9998505050505050505050565b5f610998825490565b5f61196b613d30565b5f807f4d9f77ff47b5a86f69f849f0468d24908e3c97653ee3cbecc5bb86ff0f7de941845f0151856020015186604001518760600151886080015160405160200161324f969594939291909586526001600160801b031994851660208701529290931660408501526001600160a01b03166060840152608083019190915260a082015260c00190565b604051602081830303815290604052805190602001209050611919838260405161190160f01b8152600281019290925260228201526042902090565b5f805f6132988585613da3565b5090925090505f8160038111156132b1576132b1615781565b1480156132cf5750856001600160a01b0316826001600160a01b0316145b806132e057506132e0868686613dec565b9695505050505050565b5f805f806132f88686613da3565b9250925092506133088282613ec2565b5090949350505050565b60035460801b6001600160801b03191661332f60208a018a615308565b6001600160801b0319161461334b57611f516020890189615308565b8760c00135421061337557604051630f5f3b2360e41b815260c089013560048201526024016114fa565b5f61338a846040516020016127e89190615795565b90505f613398848484613f7a565b9050600a5481146133d157600a5460405163117cd02b60e01b8152600481018490526024810183905260448101919091526064016114fa565b505f90506133f46133e7368b90038b018b61581a565b6133ef6131bd565b613fb2565b600254909150600160a81b900460ff1615801561345d575061345b61341f6040860160208701614e39565b828a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f9201919091525061328b92505050565b155b156134e1575f6134a2828a8a8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152506132ea92505050565b9050806134b56040870160208801614e39565b604051631fb7a3a360e01b81526001600160a01b039283166004820152911660248201526044016114fa565b5f6135218288888080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152506132ea92505050565b905061353a5f80516020615afe83398151915282611921565b613562576040516301120d5160e31b81526001600160a01b03821660048201526024016114fa565b505f905060088161357960408c0160208d01615308565b6001600160801b0319166001600160801b03191681526020019081526020015f2090505f6135c98a60200160208101906135b39190615308565b6135c3608088016060890161533b565b5f612c0c565b9050808a6060013511156135fd576040516372b4ba4160e11b815260608b01356004820152602481018290526044016114fa565b505f61361960608b013561313d368d90038d0160808e01615767565b90505f61366661362f60408d0160208e01615308565b61363f6060890160408a0161533b565b6001600160401b031661365860a08a0160808b01614cd8565b8e606001358f60800161311b565b90508a60600135835f015f82825461367e91906154d7565b90915550506001830180548391905f906136a29084906001600160401b0316615606565b92506101000a8154816001600160401b0302191690836001600160401b031602179055508a6060013560045f8282546136db91906154d7565b925050819055508060055f8282546136f391906154d7565b90915550613709905060608c0160408d01614e39565b6001600160a01b031661372260408d0160208e01615308565b6001600160801b03191660035f9054906101000a900460801b6001600160801b0319167fddc469e1e78b774ed8fa261ecf2cb0081b304697ade1665e57a5e2d6271343758e60600135868660405161378d939291909283526020830191909152604082015260600190565b60405180910390a46137c96137a860608d0160408e01614e39565b6137b68360608f01356156ad565b6002546001600160a01b03169190612fc0565b5050505050505050505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff1661108057604051631afcd79f60e31b815260040160405180910390fd5b6138276137d6565b5f80516020615a9e8339815191527fa16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d10261386084826158f7565b506003810161386f83826158f7565b505f8082556001909101555050565b5f5f80516020615b1e8339815191526138978484611921565b613916575f848152602082815260408083206001600160a01b03871684529091529020805460ff191660011790556138cc3390565b6001600160a01b0316836001600160a01b0316857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a46001915050610998565b5f915050610998565b5092915050565b5f611cb2836001600160a01b0384166140d2565b5f81515f0361394a57505f919050565b61395582600161411e565b91505b6001825111156139745761396d82600161411e565b9150613958565b815f81518110613986576139866152f4565b60200260200101519050919050565b61399f8282611921565b610f1a5760405163e2517d3f60e01b81526001600160a01b0382166004820152602481018390526044016114fa565b80515f906001600160a01b03166139e657505f919050565b60208201516001600160d01b031916657bb7577aaf5760d11b01613a6757815f01516001600160a01b031663fbccedae6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613a43573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061099891906156c0565b60208201516001600160d01b03191665b275294801e560d01b01613aca5781516040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015613a43573d5f803e3d5ffd5b602082015160405163084523c560e11b81526001600160d01b031990911660048201526024016114fa565b5f838302815f1985870982811083820303915050805f03613b2957838281613b1f57613b1f6159b2565b0492505050611cb2565b808411613b495760405163227bc15360e01b815260040160405180910390fd5b5f848688095f868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b5f5f80516020615b1e833981519152613bcd8484611921565b15613916575f848152602082815260408083206001600160a01b0387168085529252808320805460ff1916905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a46001915050610998565b5f611cb2836001600160a01b0384166142be565b5f613c556001600160a01b03841683614398565b905080515f14158015613c79575080806020019051810190613c7791906159c6565b155b1561102b57604051635274afe760e01b81526001600160a01b03841660048201526024016114fa565b5f825f018281548110613cb757613cb76152f4565b905f5260205f200154905092915050565b5f611cb282845f01518560200151613af5565b5f80848611613cea575f613cf4565b613cf485876156ad565b90505f818511613d04575f613d0e565b613d0e82866156ad565b9050612d618185612710613af5565b5f611cb2828460200151855f0151613af5565b5f7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f613d5a6143a5565b613d6261440d565b60408051602081019490945283019190915260608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b5f805f8351604103613dda576020840151604085015160608601515f1a613dcc8882858561444f565b955095509550505050613de5565b505081515f91506002905b9250925092565b5f805f856001600160a01b03168585604051602401613e0c9291906159e1565b60408051601f198184030181529181526020820180516001600160e01b0316630b135d3f60e11b17905251613e4191906159f9565b5f60405180830381855afa9150503d805f8114613e79576040519150601f19603f3d011682016040523d82523d5f602084013e613e7e565b606091505b5091509150818015613e9257506020815110155b80156132e057508051630b135d3f60e11b90613eb790830160209081019084016156c0565b149695505050505050565b5f826003811115613ed557613ed5615781565b03613ede575050565b6001826003811115613ef257613ef2615781565b03613f105760405163f645eedf60e01b815260040160405180910390fd5b6002826003811115613f2457613f24615781565b03613f455760405163fce698f760e01b8152600481018290526024016114fa565b6003826003811115613f5957613f59615781565b03610f1a576040516335e2f38360e21b8152600481018290526024016114fa565b5f81815b84811015611cae57613fa882878784818110613f9c57613f9c6152f4565b90506020020135614517565b9150600101613f7e565b6080828101518051602091820151604080517f953108a3ec009aa6b52fdec87fca4e92a1dd82710c0c6e2497368614711c355f81860152808201939093526060808401929092528051808403830181529483018152845194840194909420865184880151868901519389015160a0808b01517f34a89751a0a9c434a0b09a2df0ebf72338e87f92fc423ec7b07bb6a49af0f704918801919091526001600160801b031993841660c08801529290911660e08601526001600160a01b03909316610100850152610120840192909252610140830181905261016080840192909252845180840390920182526101808301948590528151919093012061190160f01b845261018282018590526101a290910181905260429092205f9290610fef565b5f81815260018301602052604081205461411757508154600181810184555f848152602080822090930184905584548482528286019093526040902091909155610998565b505f610998565b81516060905f61412f600283615a14565b90505f61413d600284615a27565b1580159150614154578161415081615a3a565b9250505b858561419f57826001600160401b03811115614172576141726146ae565b60405190808252806020026020018201604052801561419b578160200160208202803683370190505b5090505b5f826141ab57836141b6565b6141b66001856156ad565b90505f5b818110156142445761421f896141d1836002615a52565b815181106141e1576141e16152f4565b60200260200101518a8360026141f79190615a52565b6142029060016154d7565b81518110614212576142126152f4565b6020026020010151614517565b838281518110614231576142316152f4565b60209081029190910101526001016141ba565b5082156142a9576142808861425a6001886156ad565b8151811061426a5761426a6152f4565b60200260200101518960018861420291906156ad565b8261428c6001876156ad565b8151811061429c5761429c6152f4565b6020026020010181815250505b86156142b3578382525b509695505050505050565b5f8181526001830160205260408120548015613916575f6142e06001836156ad565b85549091505f906142f3906001906156ad565b9050808214614352575f865f018281548110614311576143116152f4565b905f5260205f200154905080875f018481548110614331576143316152f4565b5f918252602080832090910192909255918252600188019052604090208390555b855486908061436357614363615a69565b600190038181905f5260205f20015f90559055856001015f8681526020019081526020015f205f905560019350505050610998565b6060611cb283835f614543565b5f5f80516020615a9e833981519152816143bd613012565b8051909150156143d557805160209091012092915050565b815480156143e4579392505050565b7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470935050505090565b5f5f80516020615a9e833981519152816144256130d2565b80519091501561443d57805160209091012092915050565b600182015480156143e4579392505050565b5f80807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a084111561448857505f9150600390508261450d565b604080515f808252602082018084528a905260ff891692820192909252606081018790526080810186905260019060a0016020604051602081039080840390855afa1580156144d9573d5f803e3d5ffd5b5050604051601f1901519150506001600160a01b03811661450457505f92506001915082905061450d565b92505f91508190505b9450945094915050565b5f818310614531575f828152602084905260409020611cb2565b5f838152602083905260409020611cb2565b6060814710156145685760405163cd78605960e01b81523060048201526024016114fa565b5f80856001600160a01b0316848660405161458391906159f9565b5f6040518083038185875af1925050503d805f81146145bd576040519150601f19603f3d011682016040523d82523d5f602084013e6145c2565b606091505b50915091506132e08683836060826145e2576145dd82614629565b611cb2565b81511580156145f957506001600160a01b0384163b155b1561462257604051639996b31560e01b81526001600160a01b03851660048201526024016114fa565b5080611cb2565b8051156146395780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b5080545f825560010160029004905f5260205f209081019061184891905b80821115614683575f8155600101614670565b5090565b5f60208284031215614697575f80fd5b81356001600160e01b031981168114611cb2575f80fd5b634e487b7160e01b5f52604160045260245ffd5b604051606081016001600160401b03811182821017156146e4576146e46146ae565b60405290565b60405160a081016001600160401b03811182821017156146e4576146e46146ae565b6040516101c081016001600160401b03811182821017156146e4576146e46146ae565b604051601f8201601f191681016001600160401b0381118282101715614757576147576146ae565b604052919050565b6001600160a01b0381168114611848575f80fd5b803561477e8161475f565b919050565b80356001600160801b03198116811461477e575f80fd5b6001600160d01b031981168114611848575f80fd5b5f606082840312156147bf575f80fd5b6147c76146c2565b905081356147d48161475f565b815260208201356147e48161479a565b602082015260408201356147f78161479a565b604082015292915050565b5f6001600160401b0382111561481a5761481a6146ae565b5060051b60200190565b6001600160401b0381168114611848575f80fd5b8015158114611848575f80fd5b5f60a08284031215614855575f80fd5b61485d6146ea565b905061486882614783565b815260208201356148788161475f565b6020820152604082013561488b81614824565b6040820152606082013561489e81614824565b606082015260808201356148b181614838565b608082015292915050565b5f82601f8301126148cb575f80fd5b813560206148e06148db83614802565b61472f565b8083825260208201915060a0602060a08602880101945087851115614903575f80fd5b602087015b858110156149275761491a8982614845565b8452928401928101614908565b5090979650505050505050565b803561ffff8116811461477e575f80fd5b5f60608284031215614955575f80fd5b61495d6146c2565b905061496882614783565b815260208201356149788161475f565b60208201526147f760408301614934565b5f82601f830112614998575f80fd5b813560206149a86148db83614802565b8083825260208201915060606020606086028801019450878511156149cb575f80fd5b602087015b85811015614927576149e28982614945565b84529284019281016149d0565b5f602082840312156149ff575f80fd5b81356001600160401b0380821115614a15575f80fd5b908301906102008286031215614a29575f80fd5b614a3161470c565b614a3a83614773565b8152614a4860208401614783565b6020820152614a5a86604085016147af565b6040820152614a6b60a08401614773565b606082015260c083013582811115614a81575f80fd5b614a8d878286016148bc565b60808301525060e083013582811115614aa4575f80fd5b614ab087828601614989565b60a0830152506101009150614ac6828401614773565b60c0820152610120614ad9818501614773565b60e0830152610140614aec818601614773565b848401526101609350614b00848601614773565b828401526101809150614b14828601614773565b908301526101a0614b26858201614773565b848401526101c085013582840152614b416101e08601614934565b908301525095945050505050565b5f60208284031215614b5f575f80fd5b5035919050565b5f8083601f840112614b76575f80fd5b5081356001600160401b03811115614b8c575f80fd5b6020830191508360208260051b8501011115614ba6575f80fd5b9250929050565b5f8060208385031215614bbe575f80fd5b82356001600160401b03811115614bd3575f80fd5b614bdf85828601614b66565b90969095509350505050565b5f815180845260208085019450602084015f5b83811015614c1a57815187529582019590820190600101614bfe565b509495945050505050565b602081525f611cb26020830184614beb565b5f8060408385031215614c48575f80fd5b823591506020830135614c5a8161475f565b809150509250929050565b5f805f60408486031215614c77575f80fd5b83356001600160401b0380821115614c8d575f80fd5b818601915086601f830112614ca0575f80fd5b813581811115614cae575f80fd5b87602060a083028501011115614cc2575f80fd5b6020928301989097509590910135949350505050565b5f60208284031215614ce8575f80fd5b8135611cb281614838565b5f805f805f60608688031215614d07575f80fd5b85356001600160401b0380821115614d1d575f80fd5b614d2989838a01614b66565b90975095506020880135915080821115614d41575f80fd5b50614d4e88828901614b66565b9094509250506040860135614d6281614838565b809150509295509295909350565b5f8083601f840112614d80575f80fd5b5081356001600160401b03811115614d96575f80fd5b602083019150836020606083028501011115614ba6575f80fd5b5f8060208385031215614dc1575f80fd5b82356001600160401b03811115614dd6575f80fd5b614bdf85828601614d70565b602080825282518282018190525f919060409081850190868401855b82811015614e2c578151805185528601516001600160401b0316868501529284019290850190600101614dfe565b5091979650505050505050565b5f60208284031215614e49575f80fd5b8135611cb28161475f565b5f805f60608486031215614e66575f80fd5b8335614e718161475f565b92506020840135614e818161475f565b929592945050506040919091013590565b5f60608284031215614ea2575f80fd5b50919050565b602080825282518282018190525f919060409081850190868401855b82811015614e2c57815180516001600160a01b0316855286015161ffff16868501529284019290850190600101614ec4565b5f5b83811015614f10578181015183820152602001614ef8565b50505f910152565b5f8151808452614f2f816020860160208601614ef6565b601f01601f19169290920160200192915050565b60ff60f81b8816815260e060208201525f614f6160e0830189614f18565b8281036040840152614f738189614f18565b606084018890526001600160a01b038716608085015260a0840186905283810360c08501529050614fa48185614beb565b9a9950505050505050505050565b5f8060408385031215614fc3575f80fd5b50508035926020909101359150565b602080825282518282018190525f9190848201906040850190845b818110156150135783516001600160801b03191683529284019291840191600101614fed565b50909695505050505050565b5f805f60608486031215615031575f80fd5b505081359360208301359350604090920135919050565b5f805f838503606081121561505b575f80fd5b84356001600160401b0380821115615071575f80fd5b818701915087601f830112615084575f80fd5b813581811115615092575f80fd5b8860208260071b85010111156150a6575f80fd5b6020929092019550909350506040601f19820112156150c3575f80fd5b506020840190509250925092565b5f602082840312156150e1575f80fd5b611cb282614934565b5f80602083850312156150fb575f80fd5b82356001600160401b0380821115615111575f80fd5b818501915085601f830112615124575f80fd5b813581811115615132575f80fd5b8660208260061b8501011115615146575f80fd5b60209290920196919550909350505050565b5f60a08284031215614ea2575f80fd5b5f8083601f840112615178575f80fd5b5081356001600160401b0381111561518e575f80fd5b602083019150836020828501011115614ba6575f80fd5b5f805f805f60e086880312156151b9575f80fd5b6151c38787615158565b945060a08601356001600160401b03808211156151de575f80fd5b6151ea89838a01615168565b909650945060c0880135915080821115615202575f80fd5b5061520f88828901615168565b969995985093965092949392505050565b5f805f805f805f805f898b0361020081121561523a575f80fd5b60e0811215615247575f80fd5b5089985060e08a01356001600160401b0380821115615264575f80fd5b6152708d838e01615168565b909a5098506101008c0135915080821115615289575f80fd5b6152958d838e01615168565b90985096508691506152ab8d6101208e01615158565b95506101c08c01359150808211156152c1575f80fd5b506152ce8c828d01614b66565b9094509250506101e08a01356152e381614838565b809150509295985092959850929598565b634e487b7160e01b5f52603260045260245ffd5b5f60208284031215615318575f80fd5b611cb282614783565b5f60a08284031215615331575f80fd5b611cb28383614845565b5f6020828403121561534b575f80fd5b8135611cb281614824565b5f60608284031215615366575f80fd5b611cb28383614945565b5f60608284031215615380575f80fd5b611cb283836147af565b81356153958161475f565b81546001600160a01b031981166001600160a01b0392909216918217835560208401356153c18161479a565b65ffffffffffff60a01b60309190911c166001600160d01b03199182168317811784556040850135916153f38361479a565b9217911617905550565b60608101823561540c8161475f565b6001600160a01b0316825260208301356154258161479a565b6001600160d01b031990811660208401526040840135906154458261479a565b8082166040850152505092915050565b60408152602460408201527f736574556e6c6f636b65722828616464726573732c6279746573362c627974656060820152637336292960e01b608082015260a060208201525f611cb260a0830184614f18565b5f602082840312156154b8575f80fd5b8151611cb28161475f565b634e487b7160e01b5f52601160045260245ffd5b80820180821115610998576109986154c3565b8135815560018101602083013561550081614824565b815467ffffffffffffffff19166001600160401b03919091161790555050565b61ffff82811682821603908082111561391f5761391f6154c3565b61ffff81811683821601908082111561391f5761391f6154c3565b5f60a08284031215615566575f80fd5b61556e6146ea565b61557783614783565b815261558560208401614783565b602082015260408301356155988161475f565b6040820152606083810135908201526080928301359281019290925250919050565b6020808252602c908201527f656e74697479555549442063616e6e6f742062652074686520706c6174666f7260408201526b1b48195b9d1a5d1e5555525160a21b606082015260800190565b6001600160401b0381811683821601908082111561391f5761391f6154c3565b606080825284519082018190525f906020906080840190828801845b8281101561565e57815184529284019290840190600101615642565b5050506020840195909552505060400152919050565b60408152601060408201526f736574456e61626c656428626f6f6c2960801b6060820152608060208201525f611cb26080830184614f18565b81810381811115610998576109986154c3565b5f602082840312156156d0575f80fd5b5051919050565b602081525f611cb26020830184614f18565b600181811c908216806156fd57607f821691505b602082108103614ea257634e487b7160e01b5f52602260045260245ffd5b5f6040828403121561572b575f80fd5b604051604081018181106001600160401b038211171561574d5761574d6146ae565b604052823581526020928301359281019290925250919050565b5f60408284031215615777575f80fd5b611cb2838361571b565b634e487b7160e01b5f52602160045260245ffd5b60a081016001600160801b03196157ab84614783565b16825260208301356157bc8161475f565b6001600160a01b0316602083015260408301356157d881614824565b6001600160401b0390811660408401526060840135906157f782614824565b166060830152608083013561580b81614838565b80151560808401525092915050565b5f60e0828403121561582a575f80fd5b60405160c081018181106001600160401b038211171561584c5761584c6146ae565b60405261585883614783565b815261586660208401614783565b602082015260408301356158798161475f565b604082015260608381013590820152615895846080850161571b565b608082015260c0929092013560a083015250919050565b601f82111561102b57805f5260205f20601f840160051c810160208510156158d15750805b601f840160051c820191505b818110156158f0575f81556001016158dd565b5050505050565b81516001600160401b03811115615910576159106146ae565b6159248161591e84546156e9565b846158ac565b602080601f831160018114615957575f84156159405750858301515b5f19600386901b1c1916600185901b178555610d74565b5f85815260208120601f198616915b8281101561598557888601518255948401946001909101908401615966565b50858210156159a257878501515f19600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b5f52601260045260245ffd5b5f602082840312156159d6575f80fd5b8151611cb281614838565b828152604060208201525f6119196040830184614f18565b5f8251615a0a818460208701614ef6565b9190910192915050565b5f82615a2257615a226159b2565b500490565b5f82615a3557615a356159b2565b500690565b5f60018201615a4b57615a4b6154c3565b5060010190565b8082028115828204841417610998576109986154c3565b634e487b7160e01b5f52603160045260245ffdfec1f6fe24621ce81ec5827caf0253cadb74709b061630e6b55e82371705932000a16a46d94261c7517cc8ff89f61c0ce93598e3c849801011dee649a6a557d100241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08eb80ee6ccad1a05bacb615631c5c657518a93babef3d070b1c2aa8d8f2d00cbfe2f4eaae4a9751e85a3e4a7b9587827a877f29914755229b07a7b2da98285f7002dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b62680063d8e56f0160910d57b83f54cac0b3871607c2529985aa50e353236389f5accaf0d6c3c8ca089b9e67e712dd7b15ff94395328b650078948c3ebdde284f94f6ea2646970667358221220fc04dead98cb336a1645e8b42e60d41ced52eddedc06035d0527211c7d076f3c64736f6c63430008170033

Block Transaction Gas Used Reward
view all blocks ##produced##

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

Validator Index Block Amount
View All Withdrawals

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

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.