Skip to content
Verified contractPartialMIT

PeddlesFactoryV20

Address0xbe02501376831dd3dc6617ba0bbfb1c43f9d1978
Balance

0 ETH

 

Transactions

0

 

Compiler

solc 0.8.26

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.26+commit.8a97fa7a
Language
solidity
Optimization
Yes, 200 runs
EVM version
cancun
Via IR
yes
License
MIT
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,373,992
Creation transaction
0x9832e7a735…bc9b76da9f

src/PeddlesFactoryV20.sol

// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

/*

               _______  _______  ______   ______   _        _______
      (  ____ )(  ____ \(  __  \ (  __  \ ( \      (  ____ \(  ____ \
      | (    )|| (    \/| (  \  )| (  \  )| (      | (    \/| (    \/
      | (____)|| (__    | |   ) || |   ) || |      | (__    | (_____
      |  _____)|  __)   | |   | || |   | || |      |  __)   (_____  )
      | (      | (      | |   ) || |   ) || |      | (            ) |
      | )      | (____/\| (__/  )| (__/  )| (____/\| (____/\/\____) |
      |/       (_______/(______/ (______/ (_______/(_______/\_______)


      THE STOCK-PAIRED LAUNCHPAD

      Launch tokens and NFTs paired against tokenised stocks.
      100% of supply goes to liquidity, locked from block zero.
      Holders earn the stock you are paired to.

      Website     https://peddles.xyz
      X           https://x.com/PeddlesX
      Telegram    https://t.me/peddlesnews


*/

/// @notice Callback exposed by the factory while a token is being deployed.
/// The token constructor has no arguments, so its CREATE2 creation bytecode is fixed.
interface IPeddlesParametersV20 {
    function peddlesParameters()
        external
        view
        returns (
            uint8 version,
            string memory name_,
            string memory symbol_,
            address initialAdmin,
            uint8 decimals_
        );
}

/// @title PeddlesTokenV20
/// @notice Self-contained ERC20 used by PeddlesFactoryV20.
contract PeddlesTokenV20 {
    // ---------------------------------------------------------------------
    // ERC20 events
    // ---------------------------------------------------------------------

    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);

    // ---------------------------------------------------------------------
    // Role events (OZ-compatible shape)
    // ---------------------------------------------------------------------

    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    // ---------------------------------------------------------------------
    // Peddles metadata/cap events
    // ---------------------------------------------------------------------

    event SupplyCapUpdated(uint256 previousCap, uint256 newCap);
    event ContractURIUpdated(string uri);
    event ExtraMetadataUpdated(string indexed key, string value);

    // ---------------------------------------------------------------------
    // Exact role constants
    // ---------------------------------------------------------------------

    bytes32 public constant DEFAULT_ADMIN_ROLE = bytes32(0);
    bytes32 public constant MINT_ROLE = keccak256("MINT_ROLE");
    bytes32 public constant BURN_ROLE = keccak256("BURN_ROLE");
    bytes32 public constant METADATA_ROLE = keccak256("METADATA_ROLE");

    // ---------------------------------------------------------------------
    // Errors
    // ---------------------------------------------------------------------

    error ZeroAddress();
    error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);
    error AccessControlBadConfirmation();
    error LastAdminMustUseRenounceLastAdmin();
    error NotFinalAdmin();
    error SupplyCapExceeded(uint256 cap, uint256 requestedSupply);
    error SupplyCapBelowCurrentSupply(uint256 currentSupply, uint256 requestedCap);
    error ERC20InsufficientBalance(address account, uint256 balance, uint256 needed);
    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);
    /// @dev `setHolderRewards` was called a second time, or with zero.
    error HolderRewardsAlreadySet();
    /// @dev The caller supplied too little gas for the holder-rewards notification's full stipend.
    error NotifyGasTooLow();

    /// @notice Emitted once, when the launch binds this token's holder-rewards distributor.
    event HolderRewardsSet(address indexed rewards);

    /// @notice This token's `PeddlesHolderRewards`, notified of every balance change so reward
    /// shares follow real balances. Bound once by an admin — in practice the launch orchestrator,
    /// inside the launch transaction, before it renounces the last admin role — then frozen.
    address public holderRewards;

    /// @notice Gas forwarded to every holder-rewards notification.
    uint256 public constant HOLDER_NOTIFY_GAS = 250_000;

    // ---------------------------------------------------------------------
    // ERC20 storage
    // ---------------------------------------------------------------------

    string private _name;
    string private _symbol;
    uint8 private _decimals;
    uint256 private _totalSupply;

    mapping(address => uint256) private _balances;
    mapping(address => mapping(address => uint256)) private _allowances;

    // ---------------------------------------------------------------------
    // Role storage
    // ---------------------------------------------------------------------

    mapping(bytes32 => mapping(address => bool)) private _roles;
    uint256 private _defaultAdminCount;

    // ---------------------------------------------------------------------
    // Peddles storage
    // ---------------------------------------------------------------------

    address public immutable factory;
    uint256 public supplyCap;
    string public contractURI;
    mapping(string => string) private _extraMetadata;

    // ---------------------------------------------------------------------
    // Constructor: NO arguments by design
    // ---------------------------------------------------------------------

    /// @dev NOT payable. It used to be, and `createPeddles` forwarded `msg.value` here — but this
    /// token has no `receive`, no `withdraw`, and never reads its own balance, so every wei sent
    /// that way was permanently unrecoverable. Confirmed independently by the stuck-funds audit
    /// and by slither's `locked-ether` detector. CLAUDE.md forbids a value path with no exit.
    constructor() {
        factory = msg.sender;

        (
            uint8 version,
            string memory name_,
            string memory symbol_,
            address initialAdmin,
            uint8 decimals_
        ) = IPeddlesParametersV20(msg.sender).peddlesParameters();

        require(version == 1, "BAD_ASSET_VERSION");
        require(bytes(name_).length >= 1 && bytes(name_).length <= 120, "BAD_ASSET_NAME");
        require(bytes(symbol_).length >= 1 && bytes(symbol_).length <= 24, "BAD_ASSET_SYMBOL");
        require(initialAdmin != address(0), "ZERO_ADMIN");
        require(decimals_ >= 6 && decimals_ <= 18, "BAD_DECIMALS");

        _name = name_;
        _symbol = symbol_;
        _decimals = decimals_;

        // The orchestrator/caller is the permanent initial admin.
        _grantRole(DEFAULT_ADMIN_ROLE, initialAdmin);

        // The factory is a temporary admin so it can execute initCalls.
        if (msg.sender != initialAdmin) {
            _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
        }
    }

    // ---------------------------------------------------------------------
    // ERC20 metadata and state
    // ---------------------------------------------------------------------

    function name() external view returns (string memory) {
        return _name;
    }

    function symbol() external view returns (string memory) {
        return _symbol;
    }

    function decimals() external view returns (uint8) {
        return _decimals;
    }

    function totalSupply() external view returns (uint256) {
        return _totalSupply;
    }

    function balanceOf(address account) external view returns (uint256) {
        return _balances[account];
    }

    function allowance(address owner, address spender) external view returns (uint256) {
        return _allowances[owner][spender];
    }

    function transfer(address to, uint256 amount) external returns (bool) {
        _transfer(msg.sender, to, amount);
        return true;
    }

    function approve(address spender, uint256 amount) external returns (bool) {
        if (spender == address(0)) revert ZeroAddress();
        _allowances[msg.sender][spender] = amount;
        emit Approval(msg.sender, spender, amount);
        return true;
    }

    function transferFrom(address from, address to, uint256 amount) external returns (bool) {
        uint256 currentAllowance = _allowances[from][msg.sender];
        if (currentAllowance != type(uint256).max) {
            if (currentAllowance < amount) {
                revert ERC20InsufficientAllowance(msg.sender, currentAllowance, amount);
            }
            unchecked {
                _allowances[from][msg.sender] = currentAllowance - amount;
            }
            emit Approval(from, msg.sender, _allowances[from][msg.sender]);
        }

        _transfer(from, to, amount);
        return true;
    }

    // ---------------------------------------------------------------------
    // Mint / burn / cap
    // ---------------------------------------------------------------------

    /// @notice Mint tokens. Caller must hold MINT_ROLE and the cap is enforced.
    function mint(address to, uint256 amount) external onlyRole(MINT_ROLE) {
        if (to == address(0)) revert ZeroAddress();

        uint256 newSupply = _totalSupply + amount;
        if (newSupply > supplyCap) {
            revert SupplyCapExceeded(supplyCap, newSupply);
        }

        _totalSupply = newSupply;
        _balances[to] += amount;
        emit Transfer(address(0), to, amount);
        _notifyHolderRewards(address(0), to, amount);
    }

    /// @notice Bind the holder-rewards distributor. Admin only, ONCE, never to zero.
    /// @dev The launch orchestrator calls this before `renounceLastAdmin`, so after launch nobody
    /// holds the role that could call it — and it could not be called again anyway.
    function setHolderRewards(address rewards) external onlyRole(DEFAULT_ADMIN_ROLE) {
        if (rewards == address(0)) revert ZeroAddress();
        if (holderRewards != address(0)) revert HolderRewardsAlreadySet();
        holderRewards = rewards;
        emit HolderRewardsSet(rewards);
    }

    /// @notice Burn the caller's own balance. Caller must hold BURN_ROLE.
    function burn(uint256 amount) external onlyRole(BURN_ROLE) {
        uint256 balance = _balances[msg.sender];
        if (balance < amount) {
            revert ERC20InsufficientBalance(msg.sender, balance, amount);
        }

        unchecked {
            _balances[msg.sender] = balance - amount;
            _totalSupply -= amount;
        }

        emit Transfer(msg.sender, address(0), amount);
        _notifyHolderRewards(msg.sender, address(0), amount);
    }

    /// @notice Set or update the hard supply cap.
    function updateSupplyCap(uint256 newCap) external onlyRole(DEFAULT_ADMIN_ROLE) {
        if (newCap < _totalSupply) {
            revert SupplyCapBelowCurrentSupply(_totalSupply, newCap);
        }

        uint256 previousCap = supplyCap;
        supplyCap = newCap;
        emit SupplyCapUpdated(previousCap, newCap);
    }

    // ---------------------------------------------------------------------
    // Peddles metadata
    // ---------------------------------------------------------------------

    function updateContractURI(string calldata uri) external onlyRole(METADATA_ROLE) {
        contractURI = uri;
        emit ContractURIUpdated(uri);
    }

    function updateExtraMetadata(string calldata key, string calldata val) external onlyRole(METADATA_ROLE) {
        _extraMetadata[key] = val;
        emit ExtraMetadataUpdated(key, val);
    }

    function extraMetadata(string calldata key) external view returns (string memory) {
        return _extraMetadata[key];
    }

    // ---------------------------------------------------------------------
    // Role system
    // ---------------------------------------------------------------------

    modifier onlyRole(bytes32 role) {
        if (!_roles[role][msg.sender]) {
            revert AccessControlUnauthorizedAccount(msg.sender, role);
        }
        _;
    }

    function hasRole(bytes32 role, address account) public view returns (bool) {
        return _roles[role][account];
    }

    function getRoleAdmin(bytes32) external pure returns (bytes32) {
        return DEFAULT_ADMIN_ROLE;
    }

    function defaultAdminCount() external view returns (uint256) {
        return _defaultAdminCount;
    }

    /// @notice Grant any role. Caller must hold DEFAULT_ADMIN_ROLE.
    function grantRole(bytes32 role, address account) external onlyRole(DEFAULT_ADMIN_ROLE) {
        if (account == address(0)) revert ZeroAddress();
        _grantRole(role, account);
    }

    /// @notice Standard admin revocation helper used by the factory cleanup.
    function revokeRole(bytes32 role, address account) external onlyRole(DEFAULT_ADMIN_ROLE) {
        if (role == DEFAULT_ADMIN_ROLE && _roles[role][account] && _defaultAdminCount == 1) {
            revert LastAdminMustUseRenounceLastAdmin();
        }
        _revokeRole(role, account);
    }

    /// @notice OZ-style self-renunciation: account must equal msg.sender.
    /// The final admin must use renounceLastAdmin() instead.
    function renounceRole(bytes32 role, address account) external {
        if (account != msg.sender) revert AccessControlBadConfirmation();
        if (role == DEFAULT_ADMIN_ROLE && _roles[role][account] && _defaultAdminCount == 1) {
            revert LastAdminMustUseRenounceLastAdmin();
        }
        _revokeRole(role, account);
    }

    /// @notice Remove the sole remaining DEFAULT_ADMIN_ROLE holder.
    function renounceLastAdmin() external {
        if (!_roles[DEFAULT_ADMIN_ROLE][msg.sender]) {
            revert AccessControlUnauthorizedAccount(msg.sender, DEFAULT_ADMIN_ROLE);
        }
        if (_defaultAdminCount != 1) revert NotFinalAdmin();
        _revokeRole(DEFAULT_ADMIN_ROLE, msg.sender);
    }

    // ---------------------------------------------------------------------
    // Internal helpers
    // ---------------------------------------------------------------------

    function _transfer(address from, address to, uint256 amount) internal {
        if (from == address(0) || to == address(0)) revert ZeroAddress();

        uint256 balance = _balances[from];
        if (balance < amount) {
            revert ERC20InsufficientBalance(from, balance, amount);
        }

        unchecked {
            _balances[from] = balance - amount;
        }
        _balances[to] += amount;

        emit Transfer(from, to, amount);
        _notifyHolderRewards(from, to, amount);
    }

    /// @dev Tell the distributor what moved. It can NEVER block a transfer:
    ///  * fixed stipend (`HOLDER_NOTIFY_GAS`), outcome ignored — a distributor that reverts, runs
    ///    out of gas or returns garbage changes nothing here;
    ///  * no return-data copy, so a hostile callee cannot bill the transfer for a return bomb;
    ///  * runs AFTER balances are written, so anything that re-enters sees final state.
    /// The one revert it adds is `NotifyGasTooLow`, when the CALLER supplied too little gas for the
    /// stipend to arrive whole. Without it a seller could size their gas so the notification alone
    /// starves (EIP-150 forwards at most 63/64) and keep earning on tokens they no longer hold.
    function _notifyHolderRewards(address from, address to, uint256 amount) private {
        address r = holderRewards;
        if (r == address(0) || amount == 0) return;
        if (gasleft() < HOLDER_NOTIFY_GAS + HOLDER_NOTIFY_GAS / 63 + 10_000) revert NotifyGasTooLow();
        bytes memory data = abi.encodeWithSignature("onTokenTransfer(address,address,uint256)", from, to, amount);
        assembly ("memory-safe") {
            pop(call(HOLDER_NOTIFY_GAS, r, 0, add(data, 0x20), mload(data), 0, 0))
        }
    }

    function _grantRole(bytes32 role, address account) internal {
        if (_roles[role][account]) return;

        _roles[role][account] = true;
        if (role == DEFAULT_ADMIN_ROLE) {
            unchecked {
                ++_defaultAdminCount;
            }
        }

        emit RoleGranted(role, account, msg.sender);
    }

    function _revokeRole(bytes32 role, address account) internal {
        if (!_roles[role][account]) return;

        _roles[role][account] = false;
        if (role == DEFAULT_ADMIN_ROLE) {
            unchecked {
                --_defaultAdminCount;
            }
        }

        emit RoleRevoked(role, account, msg.sender);
    }
}

/// @title PeddlesFactoryV20
/// @notice Deterministic CREATE2 token factory using a Uniswap-V3-style
/// parameters callback so token constructor arguments do not affect the address.
contract PeddlesFactoryV20 is IPeddlesParametersV20 {
    // ---------------------------------------------------------------------
    // Exact event
    // ---------------------------------------------------------------------

    event PeddlesCreated(
        address indexed token,
        uint8 indexed variant,
        string name,
        string symbol,
        uint8 decimals,
        bytes eventParams
    );

    // ---------------------------------------------------------------------
    // Exact params struct
    // ---------------------------------------------------------------------

    struct AssetParamsV1 {
        uint8 version;
        string name;
        string symbol;
        address initialAdmin;
        uint8 decimals;
    }

    struct PendingPeddlesParameters {
        uint8 version;
        string name;
        string symbol;
        address initialAdmin;
        uint8 decimals;
    }

    // ---------------------------------------------------------------------
    // Constants/selectors
    // ---------------------------------------------------------------------

    uint8 public constant VARIANT_ASSET = 0;

    /// @notice The Clog launch type. A share of supply is withheld into a
    ///         PeddlesClogVault and sold into the launch's own pool in capped slices,
    ///         with the proceeds going to the creator.
    ///
    ///         This is the ID ONLY. The economics live in the variant's allocation,
    ///         declared write-once at registration, so this constant tells you WHICH
    ///         type and the chain tells you what it costs. Anything that needs the
    ///         numbers reads `variantAllocation(VARIANT_CLOG)` rather than assuming.
    uint8 public constant VARIANT_CLOG = 1;

    bytes32 private constant DEFAULT_ADMIN_ROLE = bytes32(0);
    bytes32 private constant MINT_ROLE = keccak256("MINT_ROLE");
    bytes32 private constant BURN_ROLE = keccak256("BURN_ROLE");
    bytes32 private constant METADATA_ROLE = keccak256("METADATA_ROLE");

    bytes4 private constant UPDATE_CONTRACT_URI_SELECTOR = bytes4(keccak256("updateContractURI(string)"));
    bytes4 private constant UPDATE_EXTRA_METADATA_SELECTOR = bytes4(keccak256("updateExtraMetadata(string,string)"));
    bytes4 private constant UPDATE_SUPPLY_CAP_SELECTOR = bytes4(keccak256("updateSupplyCap(uint256)"));
    bytes4 private constant GRANT_ROLE_SELECTOR = bytes4(keccak256("grantRole(bytes32,address)"));

    // NOTE: type(C).creationCode is NOT a compile-time constant, so this must be
    // `immutable` (set in the constructor), not `constant`. The hash value is
    // identical and the token's CREATE2 init code is unaffected, so determinism holds.
    bytes32 public immutable TOKEN_CREATION_CODE_HASH;

    // ---------------------------------------------------------------------
    // Ownership (2-step)
    // ---------------------------------------------------------------------
    //
    // Mirrors PeddlesOwnable in PeddlesV20.sol, inlined so this file stays
    // self-contained (it has no imports, and neither does PeddlesV20.sol).
    // Without an owner the factory could never gain a setter later, because a
    // non-upgradeable contract with no access control is frozen for good.

    address public owner;
    address public pendingOwner;

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

    modifier onlyOwner() {
        if (msg.sender != owner) revert NotOwner(msg.sender);
        _;
    }

    // ---------------------------------------------------------------------
    // Variant registry
    // ---------------------------------------------------------------------
    //
    // A "variant" is a launch type. `codePointer` is an SSTORE2-style data
    // contract whose runtime bytes — after one leading STOP byte that makes it
    // non-callable — are the token's CREATE2 creation code.
    //
    // Registration is WRITE-ONCE per variant. Re-pointing a live variant would
    // silently change every address `getPeddlesAddress` has ever quoted for it,
    // so it is forbidden outright rather than guarded. `enabled` is the only
    // mutable field: a variant can be retired from new launches without
    // invalidating tokens already deployed under it.
    //
    // Variant 0 (VARIANT_ASSET) is reserved and permanently bound to
    // PeddlesTokenV20 via TOKEN_CREATION_CODE_HASH, so existing launches are
    // byte-for-byte unaffected by anything in this registry.
    //
    // A token registered as a new variant MUST implement the same two contracts
    // this factory relies on: the no-argument constructor + `peddlesParameters()`
    // callback, and the role API used during init (`grantRole`, `revokeRole`,
    // `hasRole`, `defaultAdminCount`).

    struct Variant {
        address codePointer;
        bytes32 creationCodeHash;
        bool enabled;
    }

    /// @notice A LAUNCH TYPE's allocation, declared with the variant and permanent.
    ///
    /// This is the mechanism behind the tokenomics rule: allocation is declared by the
    /// launch type at variant registration — NOT globally, and NOT by the creator at
    /// launch time. A creator picks a type; the type's split is fixed and disclosed
    /// before they commit, and `registerVariant` is write-once, so it cannot move under
    /// them afterwards.
    ///
    /// The clog terms live here for the same reason. A clog sells a share of supply into
    /// the pool the buyer is buying from, so its size, its slice and its cadence are part
    /// of the deal a buyer is accepting — not a dial the creator sets per launch.
    struct VariantAllocation {
        uint16 liquidityBps;
        uint16 airdropBps;
        uint16 vestingBps;
        uint16 burnBps;
        /// @dev Share of supply held by the clog vault and sold in slices.
        uint16 clogBps;
        /// @dev Per-release cap, in bps OF TOTAL SUPPLY. Denominated against supply
        ///      rather than against the allocation so the size of the sell hitting the
        ///      pool does not grow just because the allocation is larger.
        uint16 clogSliceBps;
        /// @dev Minimum seconds between clog releases.
        uint64 clogMinInterval;
    }

    /// @notice Basis-point denominator for a launch type's allocation.
    uint16 public constant BPS_DENOMINATOR = 10_000;
    /// @notice Hard ceiling on a launch type's clog share. 2500 = 25%.
    ///
    /// @dev SET TO COVER EVERY DOCUMENTED CLOG SIZE, so adding one never needs a re-mine.
    ///      CLAUDE.md states the inflow consequence for 5%, 10%, 15% and 25% allocations; at
    ///      500 only the first of those could ever be registered, and each of the others would
    ///      have meant editing this constant — a bytecode change, which voids every mined
    ///      CREATE2 salt in the stack. On mainnet that is a full redeploy to ship what should
    ///      be one owner transaction.
    ///
    ///      25% is a CEILING, not a recommendation. A 25% clog routes ~75% of every unit
    ///      entering the token to the creator, and the launch page has to say so. The per-type
    ///      figure is whatever `registerVariant` was given, and it is write-once.
    uint16 public constant CLOG_BPS_MAX = 2500;

    /// @notice Longest clog release cadence a launch type may declare. Mirrors
    ///         `PeddlesClogVault.MAX_MIN_INTERVAL`, far below its 180-day escape delay, so the
    ///         escape can never become the normal way a clog leaves.
    uint64 public constant CLOG_MIN_INTERVAL_MAX = 7 days;

    mapping(uint8 => Variant) private _variants;
    mapping(uint8 => VariantAllocation) private _variantAllocation;

    event VariantRegistered(uint8 indexed variant, address codePointer, bytes32 creationCodeHash);
    event VariantAllocationDeclared(
        uint8 indexed variant,
        uint16 liquidityBps,
        uint16 airdropBps,
        uint16 vestingBps,
        uint16 burnBps,
        uint16 clogBps,
        uint16 clogSliceBps,
        uint64 clogMinInterval
    );
    event VariantEnabledSet(uint8 indexed variant, bool enabled);

    // ---------------------------------------------------------------------
    // Errors
    // ---------------------------------------------------------------------

    error AllocationBadSum(uint256 got);
    error AllocationZeroLiquidity();
    error AllocationLaunchBurnBanned();
    error AllocationAirdropClosed();
    error AllocationVestingClosed();
    error AllocationClogAboveCap(uint16 got, uint16 cap);
    error AllocationClogTermsMissing();
    error AllocationClogIntervalTooLong(uint64 got, uint64 cap);
    /// @dev A registered launch type must deploy the audited `PeddlesTokenV20`, byte for byte.
    error VariantCodeNotPeddlesToken();
    error UnsupportedVariant(uint8 variant);
    error NotOwner(address caller);
    error NotPendingOwner(address caller);
    error ZeroOwner();
    error VariantReserved(uint8 variant);
    error VariantAlreadyRegistered(uint8 variant);
    error VariantDisabled(uint8 variant);
    error EmptyVariantCode();
    error VariantCodeStoreFailed();
    error TokenDeployFailed();
    error ValueNotAccepted();
    error FactoryBusy();
    error InvalidAssetVersion(uint8 version);
    error InvalidNameLength(uint256 length);
    error InvalidSymbolLength(uint256 length);
    error InvalidDecimals(uint8 decimals);
    error InitialAdminMustBeCaller(address expected, address actual);
    error TokenAlreadyDeployed(address token);
    error ParametersUnavailable();
    error UnauthorizedParametersReader(address caller, address expectedToken);
    error EmptyInitCall(uint256 index);
    error UnsupportedInitCall(uint256 index, bytes4 selector);
    error DefaultAdminGrantForbidden(uint256 index);
    error UnsupportedRoleGrant(uint256 index, bytes32 role);
    error InitCallFailed(uint256 index, bytes revertData);
    error FactoryCleanupFailed();
    error IncorrectCreate2Address(address expected, address actual);

    // ---------------------------------------------------------------------
    // Pending deployment state
    // ---------------------------------------------------------------------

    PendingPeddlesParameters private _pending;
    bool private _creating;
    address private _expectedToken;

    /// @param initialOwner Account allowed to register variants. The token
    /// creation path itself is permissionless and unchanged.
    constructor(address initialOwner) {
        if (initialOwner == address(0)) revert ZeroOwner();
        owner = initialOwner;
        emit OwnershipTransferred(address(0), initialOwner);

        TOKEN_CREATION_CODE_HASH = keccak256(type(PeddlesTokenV20).creationCode);
    }

    // ---------------------------------------------------------------------
    // Ownership
    // ---------------------------------------------------------------------

    function transferOwnership(address nextOwner) external onlyOwner {
        if (nextOwner == address(0)) revert ZeroOwner();
        pendingOwner = nextOwner;
        emit OwnershipTransferStarted(owner, nextOwner);
    }

    function acceptOwnership() external {
        if (msg.sender != pendingOwner) revert NotPendingOwner(msg.sender);
        address previous = owner;
        owner = msg.sender;
        pendingOwner = address(0);
        emit OwnershipTransferred(previous, msg.sender);
    }

    // ---------------------------------------------------------------------
    // The exits
    //
    // This factory is not supposed to hold anything. `createPeddles` refuses value
    // outright and forwards nothing, and it never takes custody of a launched
    // token. It had NO exit of any kind all the same, and "cannot be sent value"
    // is not "provably holds none": native can be FORCED in by `selfdestruct` or
    // by this address being named a block's fee recipient, and an ERC-20 can be
    // pushed to any address by its holder. This is the address creators interact
    // with, so a mis-sent token lands here in practice, not in theory.
    //
    // Neither takes a destination: both pay `owner`, so they are not withdrawal
    // primitives. `sweepNative` is permissionless because nothing here is ever
    // owed in native, so there is nothing for a caller to steal and no key whose
    // loss should be able to strand it.
    // ---------------------------------------------------------------------

    event Rescued(address indexed asset, address indexed to, uint256 amount);

    error NothingToSweep();
    error RescueFailed();

    function sweepNative() external returns (uint256 amount) {
        amount = address(this).balance;
        if (amount == 0) revert NothingToSweep();
        address to = owner;
        if (to == address(0)) revert ZeroOwner();
        (bool ok,) = payable(to).call{value: amount}("");
        if (!ok) revert RescueFailed();
        emit Rescued(address(0), to, amount);
    }

    /// @dev Tolerates ERC-20s that return no data (USDT-style); `require(transfer(...))` cannot
    /// move those at all, which would make the rescue useless for exactly the tokens most likely
    /// to need it.
    function rescueToken(address token, uint256 amount) external onlyOwner {
        address to = owner;
        (bool ok, bytes memory data) =
            token.call(abi.encodeWithSignature("transfer(address,uint256)", to, amount));
        if (!ok || (data.length != 0 && !abi.decode(data, (bool)))) revert RescueFailed();
        emit Rescued(token, to, amount);
    }

    // ---------------------------------------------------------------------
    // Variant administration
    // ---------------------------------------------------------------------

    /// @notice Register a new launch type. Write-once per variant; variant 0 is
    /// reserved for PeddlesTokenV20 and can never be registered or overridden.
    /// @param variant Discriminator, already mixed into the CREATE2 salt by
    /// `_boundSalt`, so variants can never collide in address space.
    /// @param creationCode Full CREATE2 creation bytecode of the token to deploy.
    /// @notice Register a launch type: its token code AND its allocation, together.
    ///
    /// ── ADDING A LAUNCH TYPE NEEDS NO RE-MINE ───────────────────────────────────────────
    /// This is an owner TRANSACTION against the deployed factory, not a contract change. A
    /// new type is one call: pick an unused `variant` id (uint8, so 255 remain beside the
    /// built-in asset type), hand it creation code and an allocation, and it is launchable.
    /// No bytecode moves, no CREATE2 salt is voided, nothing redeploys.
    ///
    /// WHAT WOULD force a re-mine is editing this FILE — a new validation rule, a new field on
    /// VariantAllocation, or a changed ceiling. That is why `CLOG_BPS_MAX` is set to the top of
    /// the documented range rather than to today's only clog type: a ceiling that has to move
    /// to ship a product is a ceiling that costs a mainnet redeploy.
    ///
    /// The bans below are deliberately NOT tunable for the same reason in reverse — burn,
    /// airdrop and vesting are closed by construction, and reopening one SHOULD cost a
    /// contract change rather than an owner transaction.
    /// @dev    WRITE-ONCE per variant, deliberately. The allocation is the economics a
    ///         creator and every buyer of their token are accepting, so it is decided
    ///         before registration, not tuned afterwards. There is no setter.
    ///
    ///         The validation below fails CLOSED at registration rather than at launch.
    ///         A variant registered with an impossible allocation would otherwise be a
    ///         launch type that reverts for everyone, forever, with no way to fix it.
    function registerVariant(
        uint8 variant,
        bytes calldata creationCode,
        VariantAllocation calldata alloc
    )
        external
        onlyOwner
        returns (address codePointer)
    {
        if (variant == VARIANT_ASSET) revert VariantReserved(variant);
        if (_variants[variant].codePointer != address(0)) revert VariantAlreadyRegistered(variant);
        if (creationCode.length == 0) revert EmptyVariantCode();
        // A launch type differs from the built-in one in its ECONOMICS, never in its token. The
        // orchestrator trusts a registered variant's token as much as variant 0's (it grants it no
        // extra checks), so arbitrary bytecode here could ship a token that keeps a mint, a
        // blacklist or a fee. Only `PeddlesTokenV20`'s exact creation code is accepted.
        if (keccak256(creationCode) != TOKEN_CREATION_CODE_HASH) revert VariantCodeNotPeddlesToken();

        _validateAllocation(alloc);

        codePointer = _writeCode(creationCode);
        _variants[variant] = Variant({
            codePointer: codePointer,
            creationCodeHash: keccak256(creationCode),
            enabled: true
        });
        _variantAllocation[variant] = alloc;

        emit VariantRegistered(variant, codePointer, keccak256(creationCode));
        emit VariantAllocationDeclared(
            variant,
            alloc.liquidityBps,
            alloc.airdropBps,
            alloc.vestingBps,
            alloc.burnBps,
            alloc.clogBps,
            alloc.clogSliceBps,
            alloc.clogMinInterval
        );
    }

    /// @dev The rules a launch type's economics must satisfy, in one place.
    function _validateAllocation(VariantAllocation calldata a) internal pure {
        uint256 sum = uint256(a.liquidityBps) + a.airdropBps + a.vestingBps + a.burnBps + a.clogBps;
        if (sum != BPS_DENOMINATOR) revert AllocationBadSum(sum);
        if (a.liquidityBps == 0) revert AllocationZeroLiquidity();
        // A launch-time supply burn is banned in code, on every launch type. The only burn
        // in the system is the platform flywheel buying back PEDL with its own revenue.
        if (a.burnBps != 0) revert AllocationLaunchBurnBanned();
        // The airdrop publisher is immutable and deployed dead on both launch paths, so a
        // non-zero airdrop share would mint supply nobody can ever claim. Refused here so
        // the broken type cannot be registered at all.
        if (a.airdropBps != 0) revert AllocationAirdropClosed();
        // VESTING IS CLOSED, on every launch type. Peddles ships no vesting product, and a
        // cap merely bounded how much supply a type could lock up for its creator rather
        // than deciding whether it should. Refused at registration so the question cannot
        // be reopened by a later variant - reopening it is a contract change and a re-mine,
        // which is the point. Same shape as the airdrop refusal directly above.
        if (a.vestingBps != 0) revert AllocationVestingClosed();
        if (a.clogBps > CLOG_BPS_MAX) revert AllocationClogAboveCap(a.clogBps, CLOG_BPS_MAX);
        // A clog with no slice cap or no interval is an unbounded dump with extra steps.
        if (a.clogBps != 0 && (a.clogSliceBps == 0 || a.clogMinInterval == 0)) {
            revert AllocationClogTermsMissing();
        }
        if (a.clogMinInterval > CLOG_MIN_INTERVAL_MAX) {
            revert AllocationClogIntervalTooLong(a.clogMinInterval, CLOG_MIN_INTERVAL_MAX);
        }
    }

    /// @notice The allocation a launch of `variant` must use.
    /// @dev    Variant 0 is the built-in asset type and is not registrable, so its
    ///         allocation is stated here rather than stored: 100% liquidity, nothing else.
    function variantAllocation(uint8 variant) external view returns (VariantAllocation memory) {
        if (variant == VARIANT_ASSET) {
            return VariantAllocation({
                liquidityBps: BPS_DENOMINATOR,
                airdropBps: 0,
                vestingBps: 0,
                burnBps: 0,
                clogBps: 0,
                clogSliceBps: 0,
                clogMinInterval: 0
            });
        }
        return _variantAllocation[variant];
    }

    /// @notice Retire or re-open a variant for NEW launches. Never affects
    /// tokens already deployed, nor the addresses previously quoted for them.
    function setVariantEnabled(uint8 variant, bool enabled) external onlyOwner {
        if (variant == VARIANT_ASSET) revert VariantReserved(variant);
        if (_variants[variant].codePointer == address(0)) revert UnsupportedVariant(variant);

        _variants[variant].enabled = enabled;
        emit VariantEnabledSet(variant, enabled);
    }

    function variantInfo(uint8 variant)
        external
        view
        returns (address codePointer, bytes32 creationCodeHash, bool enabled)
    {
        if (variant == VARIANT_ASSET) {
            return (address(0), TOKEN_CREATION_CODE_HASH, true);
        }
        Variant storage v = _variants[variant];
        return (v.codePointer, v.creationCodeHash, v.enabled);
    }

    /// @notice True when `variant` can be launched right now. Callers that gate
    /// on launch type should ask the factory rather than hardcode variant 0.
    function isVariantSupported(uint8 variant) public view returns (bool) {
        if (variant == VARIANT_ASSET) return true;
        Variant storage v = _variants[variant];
        return v.codePointer != address(0) && v.enabled;
    }

    // ---------------------------------------------------------------------
    // Parameters callback used only by the token under construction
    // ---------------------------------------------------------------------

    function peddlesParameters()
        external
        view
        returns (
            uint8 version,
            string memory name_,
            string memory symbol_,
            address initialAdmin,
            uint8 decimals_
        )
    {
        if (!_creating) revert ParametersUnavailable();
        if (msg.sender != _expectedToken) {
            revert UnauthorizedParametersReader(msg.sender, _expectedToken);
        }

        PendingPeddlesParameters storage p = _pending;
        return (p.version, p.name, p.symbol, p.initialAdmin, p.decimals);
    }

    // ---------------------------------------------------------------------
    // Exact external factory interface
    // ---------------------------------------------------------------------

    function createPeddles(
        uint8 variant,
        bytes32 salt,
        bytes calldata params,
        bytes[] calldata initCalls
    ) external payable returns (address token) {
        if (_creating) revert FactoryBusy();
        // Fail loudly rather than strand it: the token constructor is non-payable and this
        // factory has no withdrawal path, so any value sent here would be unrecoverable.
        if (msg.value != 0) revert ValueNotAccepted();
        bytes32 codeHash = _requireLaunchableVariant(variant);

        AssetParamsV1 memory asset = abi.decode(params, (AssetParamsV1));
        _validateAssetParams(asset);

        bytes32 deploymentSalt = _boundSalt(variant, msg.sender, salt);
        address predicted = _computeAddress(deploymentSalt, codeHash);
        if (predicted.code.length != 0) revert TokenAlreadyDeployed(predicted);

        _creating = true;
        _expectedToken = predicted;
        _pending = PendingPeddlesParameters({
            version: asset.version,
            name: asset.name,
            symbol: asset.symbol,
            initialAdmin: asset.initialAdmin,
            decimals: asset.decimals
        });

        // The token constructor is non-payable: forwarding value here would strand it forever.
        // `createPeddles` stays `payable` because the immutable orchestrators call it that way,
        // but a non-zero value now fails LOUDLY rather than silently burning the caller's ETH.
        // Variant 0 keeps the literal `new` form so its init code — and therefore
        // every address ever quoted for it — is byte-for-byte what it always was.
        if (variant == VARIANT_ASSET) {
            token = address(new PeddlesTokenV20{salt: deploymentSalt}());
        } else {
            token = _deployRegistered(_variants[variant].codePointer, deploymentSalt, msg.value);
        }
        if (token != predicted) revert IncorrectCreate2Address(predicted, token);

        // Clear constructor parameters immediately after deployment as required.
        delete _pending;
        _expectedToken = address(0);

        PeddlesTokenV20 deployed = PeddlesTokenV20(token);

        // Metadata initCalls are intentionally first in the orchestrator's list.
        // Give the factory a temporary METADATA_ROLE so those calls can succeed.
        deployed.grantRole(METADATA_ROLE, address(this));

        for (uint256 i; i < initCalls.length; ++i) {
            bytes calldata callData = initCalls[i];
            if (callData.length < 4) revert EmptyInitCall(i);

            bytes4 selector;
            assembly ("memory-safe") {
                selector := calldataload(callData.offset)
            }

            _validateInitCall(i, selector, callData);

            (bool success, bytes memory revertData) = token.call(callData);
            if (!success) revert InitCallFailed(i, revertData);
        }

        // Remove every temporary privilege held by the factory.
        deployed.revokeRole(METADATA_ROLE, address(this));
        deployed.revokeRole(DEFAULT_ADMIN_ROLE, address(this));

        // Guarantee the required post-create admin state.
        if (
            !deployed.hasRole(DEFAULT_ADMIN_ROLE, asset.initialAdmin)
                || deployed.hasRole(DEFAULT_ADMIN_ROLE, address(this))
                || deployed.defaultAdminCount() != 1
        ) {
            revert FactoryCleanupFailed();
        }

        _creating = false;

        emit PeddlesCreated(token, variant, asset.name, asset.symbol, asset.decimals, params);
    }

    function getPeddlesAddress(uint8 variant, address sender, bytes32 salt)
        external
        view
        returns (address token)
    {
        bytes32 codeHash = _requireKnownVariant(variant);
        token = _computeAddress(_boundSalt(variant, sender, salt), codeHash);
    }

    // ---------------------------------------------------------------------
    // Optional deterministic helpers
    // ---------------------------------------------------------------------

    function boundSalt(uint8 variant, address sender, bytes32 salt) external pure returns (bytes32) {
        return _boundSalt(variant, sender, salt);
    }

    // ---------------------------------------------------------------------
    // Internal validation/address helpers
    // ---------------------------------------------------------------------

    function _validateAssetParams(AssetParamsV1 memory asset) internal view {
        if (asset.version != 1) revert InvalidAssetVersion(asset.version);

        uint256 nameLength = bytes(asset.name).length;
        if (nameLength < 1 || nameLength > 120) revert InvalidNameLength(nameLength);

        uint256 symbolLength = bytes(asset.symbol).length;
        if (symbolLength < 1 || symbolLength > 24) revert InvalidSymbolLength(symbolLength);

        if (asset.decimals < 6 || asset.decimals > 18) revert InvalidDecimals(asset.decimals);
        if (asset.initialAdmin != msg.sender) {
            revert InitialAdminMustBeCaller(msg.sender, asset.initialAdmin);
        }
    }

    function _validateInitCall(uint256 index, bytes4 selector, bytes calldata callData) internal pure {
        if (
            selector == UPDATE_CONTRACT_URI_SELECTOR || selector == UPDATE_EXTRA_METADATA_SELECTOR
                || selector == UPDATE_SUPPLY_CAP_SELECTOR
        ) {
            return;
        }

        if (selector == GRANT_ROLE_SELECTOR) {
            (bytes32 role,) = abi.decode(callData[4:], (bytes32, address));
            if (role == DEFAULT_ADMIN_ROLE) revert DefaultAdminGrantForbidden(index);
            if (role != MINT_ROLE && role != BURN_ROLE && role != METADATA_ROLE) {
                revert UnsupportedRoleGrant(index, role);
            }
            return;
        }

        revert UnsupportedInitCall(index, selector);
    }

    function _boundSalt(uint8 variant, address sender, bytes32 salt) internal pure returns (bytes32) {
        return keccak256(abi.encode(variant, sender, salt));
    }

    function _computeAddress(bytes32 boundSalt_, bytes32 codeHash) internal view returns (address token) {
        bytes32 digest = keccak256(
            abi.encodePacked(bytes1(0xff), address(this), boundSalt_, codeHash)
        );
        token = address(uint160(uint256(digest)));
    }

    // ---------------------------------------------------------------------
    // Variant resolution
    // ---------------------------------------------------------------------

    /// @dev Address-quoting path: a retired variant must still resolve, or every
    /// address previously quoted under it would become unrecoverable.
    function _requireKnownVariant(uint8 variant) internal view returns (bytes32 codeHash) {
        if (variant == VARIANT_ASSET) return TOKEN_CREATION_CODE_HASH;

        Variant storage v = _variants[variant];
        if (v.codePointer == address(0)) revert UnsupportedVariant(variant);
        return v.creationCodeHash;
    }

    /// @dev Deploy path: additionally requires the variant to be open.
    function _requireLaunchableVariant(uint8 variant) internal view returns (bytes32 codeHash) {
        codeHash = _requireKnownVariant(variant);
        if (variant != VARIANT_ASSET && !_variants[variant].enabled) revert VariantDisabled(variant);
    }

    // ---------------------------------------------------------------------
    // Creation-code storage (SSTORE2)
    // ---------------------------------------------------------------------

    /// @dev Store `data` as the runtime code of a fresh contract, behind one
    /// leading STOP byte so the data contract can never be called. Bytecode is
    /// far cheaper to store and read this way than as `bytes` in storage.
    function _writeCode(bytes calldata data) internal returns (address pointer) {
        // 0x600B5981380380925939F3 — copy everything after this 11-byte prologue
        // into memory and return it as the deployed runtime code.
        bytes memory initCode = abi.encodePacked(hex"600B5981380380925939F3", hex"00", data);

        assembly ("memory-safe") {
            pointer := create(0, add(initCode, 32), mload(initCode))
        }
        if (pointer == address(0)) revert VariantCodeStoreFailed();
    }

    /// @dev Read back the creation code, skipping the leading STOP byte.
    function _readCode(address pointer) internal view returns (bytes memory data) {
        uint256 size = pointer.code.length;
        unchecked {
            size -= 1;
        }

        data = new bytes(size);
        assembly ("memory-safe") {
            extcodecopy(pointer, add(data, 32), 1, size)
        }
    }

    function _deployRegistered(address codePointer, bytes32 deploymentSalt, uint256 value)
        internal
        returns (address token)
    {
        bytes memory code = _readCode(codePointer);

        assembly ("memory-safe") {
            token := create2(value, add(code, 32), mload(code), deploymentSalt)
        }
        if (token == address(0)) revert TokenDeployFailed();
    }
}
Compiler settingsShow
{
  "viaIR": true,
  "metadata": {
    "appendCBOR": false,
    "bytecodeHash": "none",
    "useLiteralContent": false
  },
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "cancun",
  "remappings": [
    "forge-std/=lib/forge-std/src/",
    "@uniswap/v4-core/=lib/v4-core/",
    "@uniswap/v4-periphery/=lib/v4-periphery/",
    "solady/=lib/solady/",
    "@openzeppelin/contracts/=lib/infinity-core/lib/openzeppelin-contracts/contracts/",
    "permit2/=lib/v4-periphery/lib/permit2/",
    "infinity-core/=lib/infinity-core/",
    "lib/infinity-core/lib/pancake-create3-factory/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=lib/infinity-core/lib/pancake-create3-factory/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
    "lib/infinity-core/lib/pancake-create3-factory/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=lib/infinity-core/lib/pancake-create3-factory/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
    "lib/v4-periphery/lib/permit2/lib/forge-gas-snapshot/lib/forge-std/:ds-test/=lib/v4-periphery/lib/permit2/lib/forge-gas-snapshot/lib/forge-std/lib/ds-test/src/",
    "lib/v4-periphery/lib/permit2/lib/forge-gas-snapshot/lib/forge-std/:ds-test/=lib/v4-periphery/lib/permit2/lib/forge-gas-snapshot/lib/forge-std/lib/ds-test/src/",
    "lib/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=lib/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
    "lib/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=lib/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
    "lib/infinity-core/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=lib/infinity-core/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
    "lib/infinity-core/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=lib/infinity-core/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
    "lib/infinity-core/lib/pancake-create3-factory/lib/openzeppelin-contracts/:erc4626-tests/=lib/infinity-core/lib/pancake-create3-factory/lib/openzeppelin-contracts/lib/erc4626-tests/",
    "lib/infinity-core/lib/pancake-create3-factory/lib/openzeppelin-contracts/:erc4626-tests/=lib/infinity-core/lib/pancake-create3-factory/lib/openzeppelin-contracts/lib/erc4626-tests/",
    "lib/v4-core/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=lib/v4-core/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
    "lib/v4-core/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=lib/v4-core/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
    "lib/v4-periphery/lib/permit2/lib/forge-std/:ds-test/=lib/v4-periphery/lib/permit2/lib/forge-std/lib/ds-test/src/",
    "lib/v4-periphery/lib/permit2/lib/forge-std/:ds-test/=lib/v4-periphery/lib/permit2/lib/forge-std/lib/ds-test/src/",
    "lib/v4-periphery/lib/permit2/lib/solmate/:ds-test/=lib/v4-periphery/lib/permit2/lib/solmate/lib/ds-test/src/",
    "lib/v4-periphery/lib/permit2/lib/solmate/:ds-test/=lib/v4-periphery/lib/permit2/lib/solmate/lib/ds-test/src/",
    "lib/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/:erc4626-tests/=lib/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/lib/erc4626-tests/",
    "lib/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/:erc4626-tests/=lib/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/lib/erc4626-tests/",
    "lib/v4-periphery/lib/v4-core/lib/solmate/:ds-test/=lib/v4-periphery/lib/v4-core/lib/solmate/lib/ds-test/src/",
    "lib/v4-periphery/lib/v4-core/lib/solmate/:ds-test/=lib/v4-periphery/lib/v4-core/lib/solmate/lib/ds-test/src/",
    "lib/infinity-core/lib/openzeppelin-contracts/:erc4626-tests/=lib/infinity-core/lib/openzeppelin-contracts/lib/erc4626-tests/",
    "lib/infinity-core/lib/openzeppelin-contracts/:erc4626-tests/=lib/infinity-core/lib/openzeppelin-contracts/lib/erc4626-tests/",
    "lib/infinity-core/lib/pancake-create3-factory/:forge-gas-snapshot/=lib/infinity-core/lib/pancake-create3-factory/lib/forge-gas-snapshot/src/",
    "lib/infinity-core/lib/pancake-create3-factory/:forge-gas-snapshot/=lib/infinity-core/lib/pancake-create3-factory/lib/forge-gas-snapshot/src/",
    "lib/infinity-core/lib/pancake-create3-factory/:openzeppelin-contracts/=lib/infinity-core/lib/pancake-create3-factory/lib/openzeppelin-contracts/",
    "lib/infinity-core/lib/pancake-create3-factory/:openzeppelin-contracts/=lib/infinity-core/lib/pancake-create3-factory/lib/openzeppelin-contracts/",
    "lib/infinity-core/lib/solmate/:ds-test/=lib/infinity-core/lib/solmate/lib/ds-test/src/",
    "lib/infinity-core/lib/solmate/:ds-test/=lib/infinity-core/lib/solmate/lib/ds-test/src/",
    "lib/v4-core/lib/openzeppelin-contracts/:erc4626-tests/=lib/v4-core/lib/openzeppelin-contracts/lib/erc4626-tests/",
    "lib/v4-core/lib/openzeppelin-contracts/:erc4626-tests/=lib/v4-core/lib/openzeppelin-contracts/lib/erc4626-tests/",
    "lib/v4-core/lib/solmate/:ds-test/=lib/v4-core/lib/solmate/lib/ds-test/src/",
    "lib/v4-core/lib/solmate/:ds-test/=lib/v4-core/lib/solmate/lib/ds-test/src/",
    "lib/v4-periphery/lib/permit2/:solmate/=lib/v4-periphery/lib/permit2/lib/solmate/",
    "lib/v4-periphery/lib/permit2/:solmate/=lib/v4-periphery/lib/permit2/lib/solmate/",
    "lib/v4-periphery/lib/permit2/:forge-gas-snapshot/=lib/v4-periphery/lib/permit2/lib/forge-gas-snapshot/src/",
    "lib/v4-periphery/lib/permit2/:forge-gas-snapshot/=lib/v4-periphery/lib/permit2/lib/forge-gas-snapshot/src/",
    "lib/v4-periphery/lib/permit2/:openzeppelin-contracts/=lib/v4-periphery/lib/permit2/lib/openzeppelin-contracts/",
    "lib/v4-periphery/lib/permit2/:openzeppelin-contracts/=lib/v4-periphery/lib/permit2/lib/openzeppelin-contracts/",
    "lib/v4-periphery/lib/v4-core/:solmate/=lib/v4-periphery/lib/v4-core/lib/solmate/",
    "lib/v4-periphery/lib/v4-core/:solmate/=lib/v4-periphery/lib/v4-core/lib/solmate/",
    "lib/v4-periphery/lib/v4-core/:openzeppelin-contracts/=lib/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/",
    "lib/v4-periphery/lib/v4-core/:openzeppelin-contracts/=lib/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/",
    "lib/infinity-core/:solmate/=lib/infinity-core/lib/solmate/",
    "lib/infinity-core/:solmate/=lib/infinity-core/lib/solmate/",
    "lib/infinity-core/:openzeppelin-contracts/=lib/infinity-core/lib/openzeppelin-contracts/",
    "lib/infinity-core/:openzeppelin-contracts/=lib/infinity-core/lib/openzeppelin-contracts/",
    "lib/v4-core/:solmate/=lib/v4-core/lib/solmate/",
    "lib/v4-core/:solmate/=lib/v4-core/lib/solmate/",
    "lib/v4-core/:openzeppelin-contracts/=lib/v4-core/lib/openzeppelin-contracts/",
    "lib/v4-core/:openzeppelin-contracts/=lib/v4-core/lib/openzeppelin-contracts/",
    "lib/v4-periphery/:v4-core/=lib/v4-periphery/lib/v4-core/src/",
    "lib/v4-periphery/:v4-core/=lib/v4-periphery/lib/v4-core/src/",
    "@ensdomains/=lib/v4-core/node_modules/@ensdomains/",
    "@openzeppelin/=lib/infinity-core/lib/openzeppelin-contracts/",
    "ds-test/=lib/infinity-core/lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/infinity-core/lib/openzeppelin-contracts/lib/erc4626-tests/",
    "forge-gas-snapshot/=lib/infinity-core/lib/forge-gas-snapshot/src/",
    "halmos-cheatcodes/=lib/infinity-core/lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
    "hardhat/=lib/v4-core/node_modules/hardhat/",
    "openzeppelin-contracts/=lib/infinity-core/lib/openzeppelin-contracts/",
    "pancake-create3-factory/=lib/infinity-core/lib/pancake-create3-factory/",
    "solmate/=lib/infinity-core/lib/solmate/",
    "v4-core/=lib/v4-core/src/",
    "v4-periphery/=lib/v4-periphery/"
  ]
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.