Skip to content
Verified contractPartialMIT

PeddlesHandleLauncher

Address0x506960da716b5164dc3441cbcc3fe0e2b9f11253
Balance

0 ETH

 

Transactions

1

 

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,374,090
Creation transaction
0x4f00c641c5…a96732ffdd
Libraries
src/perp/library/PeddlesPerpLib.sol:PeddlesPerpLib0x8fc3…3b25fasrc/perp/library/PeddlesPerpLong.sol:PeddlesPerpLong0x0a0b…a9d941src/perp/library/PeddlesPerpExits.sol:PeddlesPerpExits0xe460…81db47src/perp/library/PeddlesPerpShort.sol:PeddlesPerpShort0x6599…064634src/perp/library/PeddlesPerpReserve.sol:PeddlesPerpReserve0x24ed…a10ac2

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


*/

import {PeddlesHandlePotFactory} from "./PeddlesHandlePots.sol";

interface IHandleStockLaunchpad {
    function createCoinAndBuy(
        string calldata name,
        string calldata symbol,
        address quote,
        uint16 creatorTaxBps,
        uint16 excessToCreatorBps,
        bytes32 salt,
        uint256 quoteIn,
        uint256 minTokensOut
    ) external payable returns (address token, uint256 tokensOut);

    function coins(address token)
        external
        view
        returns (address creator, address quote, bytes32 poolId, uint256 positionId, uint64 createdAt, bool tokenIsCurrency0);

    function claimFees(address token) external returns (uint256 quoteAmount, uint256 tokenAmount);

    function predictCoin(address creator, bytes32 salt, string memory name, string memory symbol)
        external
        view
        returns (address);
}

/// @dev ABI mirror of `PeddlesLaunchOrchestratorV20`'s launch surface. Mirrored rather than imported
///      so this contract does not compile the V20 stack; `HandleLaunch.t.sol` pins the selector
///      (0x7b7abae5) against the real contract's build so the two cannot drift silently.
interface IHandleOrchestrator {
    struct CreateVaultsInput {
        address token;
        address creator;
        uint16 liquidityBps;
        uint16 airdropBps;
        uint16 vestingBps;
        uint16 burnBps;
        uint16 vaultBps;
        uint16 clogBps;
        bool airdropEnabled;
        uint256 liquidityAmount;
        uint256 airdropAmount;
        uint256 vestingAmount;
        uint256 burnAmount;
        uint64 vestingStart;
        uint64 vestingCliff;
        uint64 vestingDuration;
        uint64 airdropStartsAt;
        uint32 airdropEpochLength;
        uint16 airdropEpochCount;
        uint64 burnStartsAt;
        uint32 burnEpochLength;
        uint16 firstBurnBps;
        uint16 minVoteBps;
        uint16 maxVoteBps;
        uint16 defaultVoteBps;
        address quoteToken;
        address poolManager;
        address positionManager;
        address hook;
        address liquidityManager;
        address airdropPublisher;
        uint24 fee;
        int24 tickSpacing;
    }

    struct VaultSet {
        address liquidityVault;
        address airdropVault;
        address vestingVault;
        address burnVault;
    }

    struct LaunchInput {
        uint8 variant;
        bytes32 salt;
        bytes params;
        bytes[] initCalls;
        CreateVaultsInput vaultInput;
        uint16 creatorTaxBps;
        uint16 excessToCreatorBps;
        uint256 factoryValue;
        uint256 amountPeddles;
        uint160 sqrtPriceX96;
        int24 tickLower;
        int24 tickUpper;
        uint256 liquidity;
    }

    function launchAndBuy(LaunchInput calldata input, uint256 devBuyValue, uint256 minTokensOut)
        external
        payable
        returns (address token, VaultSet memory vaults, bytes32 poolId, uint256 positionId, uint256 tokensOut);

    function clogVaultFactory() external view returns (address);

    /// @dev Present only on the CREATOR-BOUND orchestrator. The launcher's constructor calls it, so a
    ///      launcher can never be wired to an orchestrator that hands the factory the raw caller salt.
    function launchSalt(address creator, bytes32 salt) external pure returns (bytes32);

    function predictLaunchToken(address creator, uint8 variant, bytes32 salt) external view returns (address);
}

interface IHandleFeeHook {
    function setCreatorPayout(bytes32 poolId, address payout) external;
}

interface IHandleClogVaultFactory {
    function vaultOf(address deployer, address token) external view returns (address);
}

interface IHandleClogVault {
    function setReleaseFloor(uint256 floorX18) external;
    function withdrawProceeds(address to) external returns (uint256 amount);
    function escape() external returns (uint256 amount);
    function sweepStray(address asset) external returns (uint256 amount);
}

interface IHandleToken {
    function balanceOf(address account) external view returns (uint256);
    function transfer(address to, uint256 amount) external returns (bool);
    function transferFrom(address from, address to, uint256 amount) external returns (bool);
    function approve(address spender, uint256 amount) external returns (bool);
}

/// @title PeddlesHandleLauncher - launch a coin FOR an X account
/// @notice This contract is the on-chain creator of every handle launch, so no human ever holds a
///         lever over the coin's creator streams:
///           * in the launch transaction it points the fee hook's creator payout at the X account's
///             pot, and it has NO other call site for `setCreatorPayout` - the binding is permanent;
///           * the launchpad's creator LP-fee share and a Clog vault's proceeds, escape slices and
///             strays reach it only through permissionless forwarders that pay that coin's pot.
///         The person who launches gets exactly the tokens of their own first buy.
///
/// NO OWNER. NO STUCK FUNDS. Value rests here only inside a call:
///   * native is accepted only mid-launch (`_lock == 2`), so a Clog vault's `withdrawProceeds` pushed
///     by a third party reverts instead of landing here - `forwardClogProceeds` pays the pot directly.
///     The forwarders and sweeps hold the lock in a third state (`_lock == 3`) that keeps `receive`
///     closed, so a caller-supplied `asset` run inside them cannot push another vault's native here;
///   * a handle coin's own tokens found at rest (a third party ran the vault's `escape`) belong to
///     that coin's pot and leave through `sweepToken` to the POT, never to the treasury;
///   * anything else at rest (forced native, a stray token nobody can attribute) leaves through
///     `sweepNative` / `sweepToken` to the immutable treasury.
contract PeddlesHandleLauncher {
    IHandleStockLaunchpad public immutable stockLaunchpad;
    IHandleOrchestrator public immutable orchestrator;
    IHandleFeeHook public immutable feeHook;
    PeddlesHandlePotFactory public immutable potFactory;
    address public immutable treasury;

    /// @notice Launched coin => its X account's pot.
    mapping(address => address) public potOf;
    /// @notice Launched coin => X numeric user id.
    mapping(address => uint64) public xUserIdOf;
    /// @notice Launched coin => its Clog vault (zero for non-Clog launches).
    mapping(address => address) public clogVaultOf;

    uint256 private _lock = 1;

    struct Ticket {
        uint64 xUserId;
        bytes32 handleHash;
        uint256 deadline;
        bytes sig;
    }

    event HandleLaunched(
        address indexed token,
        uint64 indexed xUserId,
        address indexed launcher,
        address pot,
        bytes32 handleHash,
        address clogVault,
        uint256 devBuyTokens
    );
    event Forwarded(address indexed token, address indexed asset, address indexed pot, uint256 amount);
    event StraySwept(address indexed asset, address indexed to, uint256 amount);

    error Reentrant();
    error ZeroAddress();
    error NotHandleCoin();
    error NotClogCoin();
    error CreatorMustBeLauncher();
    error ClogFloorRequired();
    error TransferFailed();
    error NothingToSweep();
    error NativeRefused();

    modifier nonReentrant() {
        if (_lock != 1) revert Reentrant();
        _lock = 2;
        _;
        _lock = 1;
    }

    /// @dev Same lock, but `receive` stays CLOSED for the call. The forwarders and sweeps never
    ///      legitimately receive native (a Clog vault's proceeds are paid to the pot directly by
    ///      `forwardClogProceeds`; `claimFees`, `escape` and `sweepStray` pay ERC-20s), and two of
    ///      them run a caller-supplied `asset`'s code, which must not be able to use the open
    ///      window of `nonReentrant` to push ANOTHER vault's native here — where the only exit for
    ///      resting native pays the treasury, not that account's pot. Found 2026-09-18 (H-1).
    modifier nonReentrantNoNative() {
        if (_lock != 1) revert Reentrant();
        _lock = 3;
        _;
        _lock = 1;
    }

    /// @notice Domain tag of the launching wallet's salt binding (see `handleSalt`).
    bytes32 public constant HANDLE_SALT_DOMAIN = keccak256("PEDDLES_HANDLE_LAUNCH_SALT");

    constructor(address stockLaunchpad_, address orchestrator_, address feeHook_, address potFactory_, address treasury_) {
        if (
            stockLaunchpad_ == address(0) || orchestrator_ == address(0) || feeHook_ == address(0)
                || potFactory_ == address(0) || treasury_ == address(0)
        ) revert ZeroAddress();
        // Fail closed on an UNBOUND orchestrator (one without `launchSalt`): it hands the factory the
        // raw salt, so anyone could call it directly with this launcher's derived salt and occupy a
        // handle coin's address. Reverts here, at deploy, rather than at the first launch.
        IHandleOrchestrator(orchestrator_).launchSalt(address(this), bytes32(0));
        stockLaunchpad = IHandleStockLaunchpad(stockLaunchpad_);
        orchestrator = IHandleOrchestrator(orchestrator_);
        feeHook = IHandleFeeHook(feeHook_);
        potFactory = PeddlesHandlePotFactory(potFactory_);
        treasury = treasury_;
    }

    /// @notice Native only inside one of this contract's own calls (a launch-fee refund, a router
    ///         refund). Outside a call it is refused, so nothing owed to a pot can come to rest here.
    receive() external payable {
        if (_lock != 2) revert NativeRefused();
    }

    // ---------------------------------------------------------------- launches

    /// @notice The salt this launcher passes on for a launch by `launcher` (the wallet calling
    ///         `launchStock` / `launchQuote`) with the caller-chosen `salt`.
    /// @dev    This contract is the on-chain creator of EVERY handle coin, so the stock launchpad and
    ///         the orchestrator bind the salt to this contract, not to the person. Without binding it
    ///         again here, all handle launches shared one address space and anyone who saw a pending
    ///         handle launch could take its address with their own ticket. Mixing in the launching
    ///         wallet gives each wallet a disjoint space, on both paths.
    function handleSalt(address launcher, bytes32 salt) public pure returns (bytes32) {
        return keccak256(abi.encode(HANDLE_SALT_DOMAIN, launcher, salt));
    }

    /// @notice Address `launchQuote` deploys to when `launcher` calls it with launch type `variant`
    ///         and `salt`.
    function predictQuoteToken(address launcher, uint8 variant, bytes32 salt) external view returns (address) {
        return orchestrator.predictLaunchToken(address(this), variant, handleSalt(launcher, salt));
    }

    /// @notice Address `launchStock` deploys to when `launcher` calls it with `salt`, `name`, `symbol`.
    function predictStockToken(address launcher, bytes32 salt, string calldata name, string calldata symbol)
        external
        view
        returns (address)
    {
        return stockLaunchpad.predictCoin(address(this), handleSalt(launcher, salt), name, symbol);
    }

    /// @notice Launch a stock-paired coin for an X account.
    /// @dev `msg.value` pays the launchpad's launch fee (any excess comes back to the caller).
    ///      A first buy pulls `quoteIn` of `quote` from the caller; approve this contract first.
    function launchStock(
        Ticket calldata ticket,
        string calldata name,
        string calldata symbol,
        address quote,
        uint16 creatorTaxBps,
        uint16 excessToCreatorBps,
        bytes32 salt,
        uint256 quoteIn,
        uint256 minTokensOut
    ) external payable nonReentrant returns (address token, uint256 tokensOut) {
        address pot = _pot(ticket);
        uint256 nativeBefore = address(this).balance - msg.value;
        uint256 quoteBefore = IHandleToken(quote).balanceOf(address(this));

        if (quoteIn != 0) {
            if (!IHandleToken(quote).transferFrom(msg.sender, address(this), quoteIn)) revert TransferFailed();
            quoteIn = IHandleToken(quote).balanceOf(address(this)) - quoteBefore;
            if (!IHandleToken(quote).approve(address(stockLaunchpad), quoteIn)) revert TransferFailed();
        }

        (token, tokensOut) = stockLaunchpad.createCoinAndBuy{value: msg.value}(
            name, symbol, quote, creatorTaxBps, excessToCreatorBps, handleSalt(msg.sender, salt), quoteIn, minTokensOut
        );
        if (quoteIn != 0 && !IHandleToken(quote).approve(address(stockLaunchpad), 0)) revert TransferFailed();

        (,, bytes32 poolId,,,) = stockLaunchpad.coins(token);
        _bind(token, poolId, pot, ticket, address(0), tokensOut);

        // Everything the launch did not consume goes back to the caller: first-buy tokens, unspent
        // quote, and the launch-fee refund.
        _send(token, msg.sender, tokensOut);
        _send(quote, msg.sender, IHandleToken(quote).balanceOf(address(this)) - quoteBefore);
        _sendNative(msg.sender, address(this).balance - nativeBefore);
    }

    /// @notice Launch a WETH/USDC/BNB-paired coin (Standard or Clog) for an X account.
    /// @param input the orchestrator's launch input, with `vaultInput.creator` = this contract
    /// @param clogFloorX18 the least native per token (1e18-scaled) a Clog slice may sell for when
    ///        someone other than the creator releases it. Required for a Clog launch; set once here,
    ///        and this contract has no other call site for `setReleaseFloor`.
    function launchQuote(
        Ticket calldata ticket,
        IHandleOrchestrator.LaunchInput calldata input,
        uint256 devBuyValue,
        uint256 minTokensOut,
        uint256 clogFloorX18
    ) external payable nonReentrant returns (address token, uint256 tokensOut) {
        if (input.vaultInput.creator != address(this)) revert CreatorMustBeLauncher();
        address pot = _pot(ticket);
        uint256 nativeBefore = address(this).balance - msg.value;

        // The launching wallet's binding (see `handleSalt`); the orchestrator then binds it to this
        // contract as the creator. Everything else in `input` is passed on unchanged.
        IHandleOrchestrator.LaunchInput memory bound = input;
        bound.salt = handleSalt(msg.sender, input.salt);

        bytes32 poolId;
        (token,, poolId,, tokensOut) = orchestrator.launchAndBuy{value: msg.value}(bound, devBuyValue, minTokensOut);

        // Zero for a Standard launch; only a Clog variant has a vault to bind.
        address clogVault = address(0);
        address clogFactory = orchestrator.clogVaultFactory();
        if (clogFactory != address(0)) {
            clogVault = IHandleClogVaultFactory(clogFactory).vaultOf(address(orchestrator), token);
        }
        if (clogVault != address(0)) {
            if (clogFloorX18 == 0) revert ClogFloorRequired();
            IHandleClogVault(clogVault).setReleaseFloor(clogFloorX18);
        }
        _bind(token, poolId, pot, ticket, clogVault, tokensOut);

        _send(token, msg.sender, tokensOut);
        _sendNative(msg.sender, address(this).balance - nativeBefore);
    }

    // -------------------------------------------------------------- forwarders

    /// @notice Claim the launchpad's creator LP-fee share for a handle coin and pay it to its pot.
    function forwardStockFees(address token) external nonReentrantNoNative {
        address pot = _requireHandleCoin(token);
        (, address quote,,,,) = stockLaunchpad.coins(token);
        uint256 qb = IHandleToken(quote).balanceOf(address(this));
        uint256 tb = IHandleToken(token).balanceOf(address(this));
        stockLaunchpad.claimFees(token);
        _forward(token, quote, pot, IHandleToken(quote).balanceOf(address(this)) - qb);
        _forward(token, token, pot, IHandleToken(token).balanceOf(address(this)) - tb);
    }

    /// @notice Pay a handle Clog coin's accrued release proceeds straight to its pot.
    function forwardClogProceeds(address token) external nonReentrantNoNative {
        address pot = _requireHandleCoin(token);
        address vault = _clogVault(token);
        uint256 amount = IHandleClogVault(vault).withdrawProceeds(pot);
        emit Forwarded(token, address(0), pot, amount);
    }

    /// @notice Run a Clog vault's `escape` (pays its creator, this contract) and forward the slice.
    function forwardClogEscape(address token) external nonReentrantNoNative {
        address pot = _requireHandleCoin(token);
        address vault = _clogVault(token);
        uint256 before = IHandleToken(token).balanceOf(address(this));
        IHandleClogVault(vault).escape();
        _forward(token, token, pot, IHandleToken(token).balanceOf(address(this)) - before);
    }

    /// @notice Run a Clog vault's `sweepStray(asset)` (pays its creator, this contract) and forward it.
    function forwardClogStray(address token, address asset) external nonReentrantNoNative {
        address pot = _requireHandleCoin(token);
        address vault = _clogVault(token);
        uint256 before = IHandleToken(asset).balanceOf(address(this));
        IHandleClogVault(vault).sweepStray(asset);
        _forward(token, asset, pot, IHandleToken(asset).balanceOf(address(this)) - before);
    }

    // -------------------------------------------------------------- stray exits

    /// @notice Native forced in outside a call (selfdestruct, coinbase). Nothing owed rests here.
    function sweepNative() external nonReentrantNoNative {
        uint256 amount = address(this).balance;
        if (amount == 0) revert NothingToSweep();
        _sendNative(treasury, amount);
        emit StraySwept(address(0), treasury, amount);
    }

    /// @notice An ERC-20 at rest here. A handle coin's own tokens go to THAT coin's pot (they can only
    ///         be a Clog escape slice or LP-fee tokens a third party pushed here); anything else goes
    ///         to the treasury.
    function sweepToken(address asset) external nonReentrantNoNative {
        uint256 amount = IHandleToken(asset).balanceOf(address(this));
        if (amount == 0) revert NothingToSweep();
        address pot = potOf[asset];
        address to = pot != address(0) ? pot : treasury;
        _send(asset, to, amount);
        emit StraySwept(asset, to, amount);
    }

    // --------------------------------------------------------------- internals

    function _pot(Ticket calldata ticket) private returns (address) {
        potFactory.verifyTicket(ticket.xUserId, ticket.handleHash, msg.sender, ticket.deadline, ticket.sig);
        return potFactory.createPot(ticket.xUserId);
    }

    function _bind(
        address token,
        bytes32 poolId,
        address pot,
        Ticket calldata ticket,
        address clogVault,
        uint256 tokensOut
    ) private {
        feeHook.setCreatorPayout(poolId, pot);
        potOf[token] = pot;
        xUserIdOf[token] = ticket.xUserId;
        clogVaultOf[token] = clogVault;
        emit HandleLaunched(token, ticket.xUserId, msg.sender, pot, ticket.handleHash, clogVault, tokensOut);
    }

    function _requireHandleCoin(address token) private view returns (address pot) {
        pot = potOf[token];
        if (pot == address(0)) revert NotHandleCoin();
    }

    function _clogVault(address token) private view returns (address vault) {
        vault = clogVaultOf[token];
        if (vault == address(0)) revert NotClogCoin();
    }

    function _forward(address token, address asset, address pot, uint256 amount) private {
        if (amount == 0) return;
        _send(asset, pot, amount);
        emit Forwarded(token, asset, pot, amount);
    }

    function _send(address asset, address to, uint256 amount) private {
        if (amount == 0) return;
        (bool ok, bytes memory data) = asset.call(abi.encodeCall(IHandleToken.transfer, (to, amount)));
        if (!ok || (data.length != 0 && !abi.decode(data, (bool)))) revert TransferFailed();
    }

    function _sendNative(address to, uint256 amount) private {
        if (amount == 0) return;
        (bool ok,) = payable(to).call{value: amount}("");
        if (!ok) revert TransferFailed();
    }
}

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


*/

/// @title Peddles handle pots — creator fees held for an X account until its owner claims them
/// @notice A coin can be launched FOR an X account that has never touched crypto. Every creator
///         stream of that coin is paid to the account's pot: a `PeddlesHandlePot` deployed with
///         CREATE2 at an address derived from X's numeric user id (never the handle string, which
///         X reassigns). The account's owner signs in with X; the Peddles oracle attests that the
///         signed-in account is that id and names the wallet the owner chose; after a delay the
///         guardian can use to cancel a bad attestation, that wallet becomes the pot's PAYEE and
///         every balance the pot holds, now or later, can be pushed to it by anyone.
///
/// TRUST, STATED PLAINLY. The oracle key is the one trusted role. It is bounded by:
///   * payee binding - an attestation names `to`; nothing else can receive a claim;
///   * a `CLAIM_DELAY` between request and effect, cancelable by the guardian (who cannot redirect);
///   * `ORACLE_DELAY` on every oracle change, and an instant guardian revoke that voids every
///     outstanding signature by bumping `epoch`.
/// A later attestation (a new wallet, or X Money delivery) replaces the payee only after its own
/// delay, so a compromised oracle is visible for 24 hours before it can redirect anything.
///
/// NO STUCK FUNDS. A pot's balance leaves by exactly two paths: `payOut` to the payee, or, for a pot
/// that never had a payee, the abandonment sweep to the immutable `treasury` after 28 days of public
/// notice (14 days idle, then a 14-day window in which ANY balance change or claim voids it).
interface IHandleERC20 {
    function balanceOf(address account) external view returns (uint256);
    function transfer(address to, uint256 amount) external returns (bool);
}

contract PeddlesHandlePot {
    /// @notice Delay between a claim request and its payout. The guardian may cancel inside it.
    uint256 public constant CLAIM_DELAY = 24 hours;
    /// @notice Idle time before a pot may be marked abandoned, and the notice window after.
    uint256 public constant ABANDON_IDLE = 14 days;
    uint256 public constant ABANDON_NOTICE = 14 days;

    PeddlesHandlePotFactory public immutable factory;
    uint64 public immutable xUserId;

    uint256 public claimNonce;
    /// @notice The wallet the pot pays. Zero until a claim has cleared its delay.
    address public payee;
    /// @notice 0 = paid in full; 1 = X Money delivery (a fee goes to the treasury).
    uint8 public payeeMode;
    address public pendingTo;
    uint8 public pendingMode;
    uint64 public pendingReadyAt;
    uint64 public lastActivity;
    uint64 public abandonMarkedAt;
    bytes32 public abandonSnapshot;

    uint256 private _lock = 1;

    event ClaimRequested(address indexed to, uint8 mode, uint256 nonce, uint64 readyAt);
    event ClaimCanceled(address indexed to);
    event PayeeSet(address indexed payee, uint8 mode);
    event Paid(address indexed asset, address indexed to, uint256 amount, uint256 fee);
    event AbandonMarked(uint64 markedAt, bytes32 snapshot);
    event AbandonVoided();
    event AbandonSwept(address indexed treasury);

    error NotFactory();
    error Reentrant();
    error BadNonce();
    error ClaimPending();
    error NoClaim();
    error NoPayee();
    error Claimed();
    error StillActive();
    error NotMarked();
    error NoticeRunning(uint64 until);
    error TransferFailed();

    modifier onlyFactory() {
        if (msg.sender != address(factory)) revert NotFactory();
        _;
    }

    modifier nonReentrant() {
        if (_lock != 1) revert Reentrant();
        _lock = 2;
        _;
        _lock = 1;
    }

    constructor(uint64 xUserId_) {
        factory = PeddlesHandlePotFactory(msg.sender);
        xUserId = xUserId_;
        lastActivity = uint64(block.timestamp);
    }

    receive() external payable {}

    // ------------------------------------------------------------------ claims

    /// @notice Start a claim with an oracle attestation for this pot's X account. It becomes the
    ///         payee once `CLAIM_DELAY` has passed and anyone settles it (`settleClaim` / `payOut`).
    /// @param mode 0 = pay `to` in full; 1 = X Money delivery (`to` is the delivery wallet, a fee
    ///        goes to the treasury). Mode 1 needs delivery to be enabled on this chain.
    function requestClaim(address to, uint8 mode, uint256 nonce, uint256 deadline, bytes calldata sig)
        external
        nonReentrant
    {
        _settle();
        if (pendingTo != address(0)) revert ClaimPending();
        if (nonce != claimNonce) revert BadNonce();
        factory.verifyClaim(xUserId, to, mode, nonce, deadline, sig);
        unchecked {
            claimNonce = nonce + 1;
        }
        uint64 readyAt = uint64(block.timestamp + CLAIM_DELAY);
        pendingTo = to;
        pendingMode = mode;
        pendingReadyAt = readyAt;
        lastActivity = uint64(block.timestamp);
        if (abandonMarkedAt != 0) {
            abandonMarkedAt = 0;
            abandonSnapshot = bytes32(0);
            emit AbandonVoided();
        }
        emit ClaimRequested(to, mode, nonce, readyAt);
    }

    /// @notice Promote a pending claim whose delay has passed. Permissionless; a no-op otherwise.
    function settleClaim() external nonReentrant {
        _settle();
    }

    /// @notice Push every listed asset's WHOLE balance to the payee. Permissionless - the keeper
    ///         calls it so the account owner pays no gas - and repeatable: fees that arrive later
    ///         go out the same way. It can only ever pay the payee (and, in delivery mode, the fee).
    /// @param assets ERC-20 addresses; `address(0)` means native.
    function payOut(address[] calldata assets) external nonReentrant {
        _settle();
        address to = payee;
        if (to == address(0)) revert NoPayee();
        uint256 feeBps = payeeMode == 1 ? factory.deliveryFeeBps() : 0;
        address treasury = factory.treasury();
        lastActivity = uint64(block.timestamp);

        for (uint256 i; i < assets.length; ++i) {
            uint256 bal = _balance(assets[i]);
            if (bal == 0) continue;
            uint256 fee = (bal * feeBps) / 10_000;
            if (fee != 0) _pay(assets[i], treasury, fee);
            _pay(assets[i], to, bal - fee);
            emit Paid(assets[i], to, bal - fee, fee);
        }
    }

    /// @notice Guardian brake, through the factory, during the delay. Clears the pending claim;
    ///         redirects nothing and leaves an existing payee in place.
    function cancelClaim() external onlyFactory {
        address to = pendingTo;
        if (to == address(0)) revert NoClaim();
        pendingTo = address(0);
        pendingMode = 0;
        pendingReadyAt = 0;
        emit ClaimCanceled(to);
    }

    function _settle() private {
        address to = pendingTo;
        if (to == address(0) || block.timestamp < pendingReadyAt) return;
        uint8 mode = pendingMode;
        payee = to;
        payeeMode = mode;
        pendingTo = address(0);
        pendingMode = 0;
        pendingReadyAt = 0;
        lastActivity = uint64(block.timestamp);
        emit PayeeSet(to, mode);
    }

    // ------------------------------------------------------------ abandonment

    /// @notice Start the public notice for a pot nobody has claimed from in `ABANDON_IDLE`.
    function markAbandoned(address[] calldata assets) external onlyFactory {
        if (payee != address(0)) revert Claimed();
        if (pendingTo != address(0)) revert ClaimPending();
        if (block.timestamp < uint256(lastActivity) + ABANDON_IDLE) revert StillActive();
        bytes32 snap = _snapshot(assets);
        abandonMarkedAt = uint64(block.timestamp);
        abandonSnapshot = snap;
        emit AbandonMarked(uint64(block.timestamp), snap);
    }

    /// @notice After the notice window, pay the pot to the treasury — but only if NOTHING changed:
    ///         any balance movement since the mark (the coin is still earning) voids it instead.
    /// @return swept true when paid, false when the mark was voided.
    function sweepAbandoned(address[] calldata assets) external onlyFactory nonReentrant returns (bool swept) {
        uint64 markedAt = abandonMarkedAt;
        if (markedAt == 0) revert NotMarked();
        if (block.timestamp < uint256(markedAt) + ABANDON_NOTICE) {
            revert NoticeRunning(uint64(uint256(markedAt) + ABANDON_NOTICE));
        }
        if (payee != address(0)) revert Claimed();
        if (pendingTo != address(0)) revert ClaimPending();

        bytes32 marked = abandonSnapshot;
        bytes32 snap = _snapshot(assets);
        abandonMarkedAt = 0;
        abandonSnapshot = bytes32(0);
        // Same asset list, same balances as at the mark, or nothing moves.
        if (snap != marked) {
            emit AbandonVoided();
            return false;
        }
        address treasury = factory.treasury();
        lastActivity = uint64(block.timestamp);
        for (uint256 i; i < assets.length; ++i) {
            uint256 bal = _balance(assets[i]);
            if (bal == 0) continue;
            _pay(assets[i], treasury, bal);
            emit Paid(assets[i], treasury, bal, 0);
        }
        emit AbandonSwept(treasury);
        return true;
    }

    // --------------------------------------------------------------- internals

    function _snapshot(address[] calldata assets) private view returns (bytes32) {
        uint256[] memory bals = new uint256[](assets.length);
        for (uint256 i; i < assets.length; ++i) {
            bals[i] = _balance(assets[i]);
        }
        return keccak256(abi.encode(assets, bals));
    }

    function _balance(address asset) private view returns (uint256) {
        if (asset == address(0)) return address(this).balance;
        (bool ok, bytes memory ret) = asset.staticcall(abi.encodeCall(IHandleERC20.balanceOf, (address(this))));
        if (!ok || ret.length < 32) return 0;
        return abi.decode(ret, (uint256));
    }

    function _pay(address asset, address to, uint256 amount) private {
        if (asset == address(0)) {
            (bool ok,) = payable(to).call{value: amount}("");
            if (!ok) revert TransferFailed();
            return;
        }
        (bool success, bytes memory data) = asset.call(abi.encodeCall(IHandleERC20.transfer, (to, amount)));
        if (!success || (data.length != 0 && !abi.decode(data, (bool)))) revert TransferFailed();
    }
}

contract PeddlesHandlePotFactory {
    uint256 public constant ORACLE_DELAY = 7 days;
    uint16 public constant MAX_DELIVERY_FEE_BPS = 500;

    address public immutable treasury;
    address public immutable guardian;
    uint16 public immutable deliveryFeeBps;

    address public owner;
    address public pendingOwner;
    address public oracle;
    address public pendingOracle;
    uint64 public pendingOracleAt;
    uint256 public epoch;
    bool public deliveryEnabled;

    bytes32 public constant CLAIM_TYPEHASH = keccak256(
        "ClaimAttestation(uint64 xUserId,address to,uint8 mode,uint256 nonce,uint256 deadline,uint256 epoch)"
    );
    bytes32 public constant TICKET_TYPEHASH = keccak256(
        "LaunchTicket(uint64 xUserId,bytes32 handleHash,address launcher,uint256 deadline,uint256 epoch)"
    );

    event PotCreated(uint64 indexed xUserId, address indexed pot);
    event OracleProposed(address indexed oracle, uint64 effectiveAt);
    event OracleUpdated(address indexed oracle, uint256 epoch);
    event OracleRevoked(uint256 epoch);
    event DeliveryEnabledSet(bool enabled);
    event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);
    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    error NotOwner();
    error NotGuardian();
    error ZeroAddress();
    error FeeTooHigh();
    error TooEarly(uint64 at);
    error NoProposal();
    error Expired();
    error BadSignature();
    error BadMode();
    error UnknownPot();
    error NothingToSweep();
    error TransferFailed();

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

    constructor(
        address owner_,
        address guardian_,
        address treasury_,
        address oracle_,
        uint16 deliveryFeeBps_,
        bool deliveryEnabled_
    ) {
        // The oracle is checked too: a factory deployed without one refuses every ticket and claim
        // until `proposeOracle` + ORACLE_DELAY, so a zero here is a mis-set env, not a choice. The
        // "no oracle" state exists only as the guardian's revoke.
        if (owner_ == address(0) || guardian_ == address(0) || treasury_ == address(0) || oracle_ == address(0)) {
            revert ZeroAddress();
        }
        if (deliveryFeeBps_ > MAX_DELIVERY_FEE_BPS) revert FeeTooHigh();
        owner = owner_;
        guardian = guardian_;
        treasury = treasury_;
        oracle = oracle_;
        deliveryFeeBps = deliveryFeeBps_;
        deliveryEnabled = deliveryEnabled_;
        emit OwnershipTransferred(address(0), owner_);
        emit OracleUpdated(oracle_, 0);
        emit DeliveryEnabledSet(deliveryEnabled_);
    }

    // ------------------------------------------------------------------ pots

    function potInitCodeHash(uint64 xUserId) public pure returns (bytes32) {
        return keccak256(abi.encodePacked(type(PeddlesHandlePot).creationCode, abi.encode(xUserId)));
    }

    function predictPot(uint64 xUserId) public view returns (address) {
        return address(
            uint160(
                uint256(
                    keccak256(abi.encodePacked(bytes1(0xff), address(this), bytes32(uint256(xUserId)), potInitCodeHash(xUserId)))
                )
            )
        );
    }

    /// @notice Deploy the pot for an X account. Permissionless and idempotent.
    function createPot(uint64 xUserId) external returns (address pot) {
        pot = predictPot(xUserId);
        if (pot.code.length != 0) return pot;
        pot = address(new PeddlesHandlePot{salt: bytes32(uint256(xUserId))}(xUserId));
        emit PotCreated(xUserId, pot);
    }

    // ---------------------------------------------------------------- oracle

    function domainSeparator() public view returns (bytes32) {
        return keccak256(
            abi.encode(
                keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
                keccak256("PeddlesHandlePots"),
                keccak256("1"),
                block.chainid,
                address(this)
            )
        );
    }

    /// @notice Revert unless the oracle signed this claim for the calling pot's own X account.
    function verifyClaim(uint64 xUserId, address to, uint8 mode, uint256 nonce, uint256 deadline, bytes calldata sig)
        external
        view
    {
        if (msg.sender != predictPot(xUserId)) revert UnknownPot();
        if (to == address(0)) revert ZeroAddress();
        if (mode > 1 || (mode == 1 && !deliveryEnabled)) revert BadMode();
        if (block.timestamp > deadline) revert Expired();
        _verify(keccak256(abi.encode(CLAIM_TYPEHASH, xUserId, to, mode, nonce, deadline, epoch)), sig);
    }

    /// @notice Revert unless the oracle signed a launch ticket binding `handleHash` to `xUserId`
    ///         for this `launcher`.
    function verifyTicket(uint64 xUserId, bytes32 handleHash, address launcher, uint256 deadline, bytes calldata sig)
        external
        view
    {
        if (block.timestamp > deadline) revert Expired();
        _verify(keccak256(abi.encode(TICKET_TYPEHASH, xUserId, handleHash, launcher, deadline, epoch)), sig);
    }

    function _verify(bytes32 structHash, bytes calldata sig) private view {
        address o = oracle;
        if (o == address(0) || sig.length != 65) revert BadSignature();
        bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator(), structHash));
        bytes32 r = bytes32(sig[0:32]);
        bytes32 s = bytes32(sig[32:64]);
        uint8 v = uint8(sig[64]);
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) revert BadSignature();
        if (ecrecover(digest, v, r, s) != o) revert BadSignature();
    }

    /// @notice Propose a new oracle. Effective only `ORACLE_DELAY` later, via `acceptOracle`.
    function proposeOracle(address next) external onlyOwner {
        if (next == address(0)) revert ZeroAddress();
        uint64 at = uint64(block.timestamp + ORACLE_DELAY);
        pendingOracle = next;
        pendingOracleAt = at;
        emit OracleProposed(next, at);
    }

    /// @notice Anyone may activate a proposal once its delay has passed.
    function acceptOracle() external {
        address next = pendingOracle;
        if (next == address(0)) revert NoProposal();
        if (block.timestamp < pendingOracleAt) revert TooEarly(pendingOracleAt);
        oracle = next;
        pendingOracle = address(0);
        pendingOracleAt = 0;
        unchecked {
            ++epoch;
        }
        emit OracleUpdated(next, epoch);
    }

    /// @notice Guardian: void the oracle and every outstanding signature instantly.
    function revokeOracle() external {
        if (msg.sender != guardian) revert NotGuardian();
        oracle = address(0);
        pendingOracle = address(0);
        pendingOracleAt = 0;
        unchecked {
            ++epoch;
        }
        emit OracleRevoked(epoch);
    }

    /// @notice Guardian: cancel a pot's pending claim during its delay. Redirects nothing.
    function cancelClaim(uint64 xUserId) external {
        if (msg.sender != guardian) revert NotGuardian();
        PeddlesHandlePot(payable(predictPot(xUserId))).cancelClaim();
    }

    function setDeliveryEnabled(bool enabled) external onlyOwner {
        deliveryEnabled = enabled;
        emit DeliveryEnabledSet(enabled);
    }

    // ----------------------------------------------------------- abandonment

    function markAbandoned(uint64 xUserId, address[] calldata assets) external onlyOwner {
        PeddlesHandlePot(payable(predictPot(xUserId))).markAbandoned(assets);
    }

    /// @notice Permissionless: after the notice window the pot pays the treasury, or the mark voids.
    function sweepAbandoned(uint64 xUserId, address[] calldata assets) external returns (bool) {
        return PeddlesHandlePot(payable(predictPot(xUserId))).sweepAbandoned(assets);
    }

    // ------------------------------------------------------------- ownership

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

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

    // ---------------------------------------------------------------- sweeps
    // No receive, no payable, no custody: only force-sent wei (selfdestruct, coinbase) or a pushed
    // ERC-20 can be here, and nobody has a claim on it, so the exit is permissionless and pays only
    // the immutable treasury. "Cannot hold value" is not "provably holds none" (no-stuck-funds).

    function sweepNative() external {
        uint256 amount = address(this).balance;
        if (amount == 0) revert NothingToSweep();
        (bool ok,) = payable(treasury).call{value: amount}("");
        if (!ok) revert TransferFailed();
    }

    function sweepToken(address asset) external {
        uint256 amount = IHandleERC20(asset).balanceOf(address(this));
        if (amount == 0) revert NothingToSweep();
        (bool ok, bytes memory data) = asset.call(abi.encodeCall(IHandleERC20.transfer, (treasury, amount)));
        if (!ok || (data.length != 0 && !abi.decode(data, (bool)))) revert TransferFailed();
    }
}
Compiler settingsShow
{
  "viaIR": true,
  "metadata": {
    "appendCBOR": false,
    "bytecodeHash": "none",
    "useLiteralContent": false
  },
  "libraries": {
    "src/perp/library/PeddlesPerpLib.sol": {
      "PeddlesPerpLib": "0x8fC3b671ccAD296d38c008a31e2a20C51e3B25FA"
    },
    "src/perp/library/PeddlesPerpLong.sol": {
      "PeddlesPerpLong": "0x0A0b78348Be1a37eCf5Fe99EaB74B28A8eA9d941"
    },
    "src/perp/library/PeddlesPerpExits.sol": {
      "PeddlesPerpExits": "0xe4600aaF6EEd091E317f1e25d79aa742CA81dB47"
    },
    "src/perp/library/PeddlesPerpShort.sol": {
      "PeddlesPerpShort": "0x65997dC3a9C549A11a8695cc56f8759655064634"
    },
    "src/perp/library/PeddlesPerpReserve.sol": {
      "PeddlesPerpReserve": "0x24ed8808Ae2f404D9C0ffadd329aFfD9E6a10Ac2"
    }
  },
  "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.