Skip to content
Verified contractExactUNLICENSED

LaunchOwnerV3

Address0xd6ce223a0711fe533c81e167e4c0c7fb8e3bd9da
Balance

0 ETH

 

Transactions

0

 

Compiler

solc 0.8.30

 

Same code

134 more contracts

 

Details

Compiler
solc 0.8.30+commit.73712a01
Language
solidity
Optimization
Yes, 200 runs
EVM version
cancun
Via IR
yes
License
UNLICENSED
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,329,325
Creation transaction
0xbdca8a8c5c…dede891b82

src/v3/LaunchOwnerV3.sol

// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.30;

import {EnforcedOptionParam} from "@layerzerolabs/oapp-evm/contracts/oapp/interfaces/IOAppOptionsType3.sol";
import {MSG_TYPE_SEND, MSG_TYPE_SEND_AND_CALL} from "../lz/GasFloor.sol";
import {GasFloorV3} from "./GasFloorV3.sol";
import {LaunchOwnerBaseV3} from "./LaunchOwnerBaseV3.sol";

/// @title LaunchOwnerV3
/// @notice LaunchOwnerV2, plus `addPeerFloors`: an added chain gets BOTH of a v3 route's enforced
///         options -- SEND and SEND_AND_CALL -- at once (v3 audit L-2). The v3 gap fee's composed
///         floor is not the plain one: toward Solana it adds the GapReceipt's compute units (owner Q60:
///         never its rent, which the source's L4 prepay P carries), toward an EVM chain the endpoint's
///         compose record.
///         v2's one-floor `addPeer` is refused (xa-evm-v3 I-2): one floor for both message types,
///         under GasFloor's v2 cap, could never set a v3 floor, so no later factory may pick it.
/// @dev Built on LaunchOwnerBaseV3, a copy of LaunchOwnerV2 with `virtual` on the two functions
///      overridden here, so the live src/v2/LaunchOwnerV2.sol text stays unchanged (xa-final-evm L-1).
contract LaunchOwnerV3 is LaunchOwnerBaseV3 {
    /// @notice LaunchOwnerV2's one-floor addPeer on a v3 token: use addPeerFloors.
    error UseAddPeerFloors();

    constructor(address oapp_, address admin_, bool sealNow, address factory_)
        LaunchOwnerBaseV3(oapp_, admin_, sealNow, factory_)
    {}

    /// @notice Refused on a v3 token, for everyone (the factory included): `addPeerFloors` only.
    function addPeer(uint32, bytes32, bytes calldata) external pure override {
        revert UseAddPeerFloors();
    }

    /// @notice Add a peer for a chain the token has none on, with its SEND floor `floor` and its
    ///         SEND_AND_CALL floor `floorComposed`. The factory only; each floor checked as
    ///         `setEnforcedOptions` checks it; refuses an endpoint id that already has a peer.
    function addPeerFloors(uint32 eid, bytes32 peer, bytes calldata floor, bytes calldata floorComposed) external {
        if (msg.sender != factory) revert NotFactory();
        if (peer == bytes32(0)) revert ZeroPeer();
        bytes32 had = oapp.peers(eid);
        if (had != bytes32(0)) revert PeerAlreadySet(eid, had);
        GasFloorV3.decode(floor);
        GasFloorV3.decode(floorComposed);
        oapp.setPeer(eid, peer);
        EnforcedOptionParam[] memory enforced = new EnforcedOptionParam[](2);
        enforced[0] = EnforcedOptionParam(eid, MSG_TYPE_SEND, floor);
        enforced[1] = EnforcedOptionParam(eid, MSG_TYPE_SEND_AND_CALL, floorComposed);
        oapp.setEnforcedOptions(enforced);
        emit PeerAdded(eid, peer);
    }

    /// @notice LaunchOwnerV2's setEnforcedOptions with the v3 cap (E6, audit E5 M-A): each entry exactly
    ///         one executor lzReceive option inside GasFloorV3's caps (gas <= MAX_LZ_RECEIVE_GAS_V3,
    ///         1,400,000), for one of the two message types, so the admin can re-set a v3 floor
    ///         (1,270,000 / 1,310,000 toward an EVM chain). LaunchOwnerV2's own bound (1,000,000) is
    ///         unchanged for v2 tokens.
    function setEnforcedOptions(EnforcedOptionParam[] calldata options) external override onlyAdmin {
        for (uint256 i = 0; i < options.length; i++) {
            uint16 msgType = options[i].msgType;
            if (msgType != MSG_TYPE_SEND && msgType != MSG_TYPE_SEND_AND_CALL) revert UnknownMessageType(msgType);
            GasFloorV3.decode(options[i].options);
        }
        oapp.setEnforcedOptions(options);
    }
}

lib/layerzero/oapp-evm/contracts/oapp/interfaces/IOAppOptionsType3.sol

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.20;

/**
 * @dev Struct representing enforced option parameters.
 */
struct EnforcedOptionParam {
    uint32 eid; // Endpoint ID
    uint16 msgType; // Message Type
    bytes options; // Additional options
}

/**
 * @title IOAppOptionsType3
 * @dev Interface for the OApp with Type 3 Options, allowing the setting and combining of enforced options.
 */
interface IOAppOptionsType3 {
    // Custom error message for invalid options
    error InvalidOptions(bytes options);

    // Event emitted when enforced options are set
    event EnforcedOptionSet(EnforcedOptionParam[] _enforcedOptions);

    /**
     * @notice Sets enforced options for specific endpoint and message type combinations.
     * @param _enforcedOptions An array of EnforcedOptionParam structures specifying enforced options.
     */
    function setEnforcedOptions(EnforcedOptionParam[] calldata _enforcedOptions) external;

    /**
     * @notice Combines options for a given endpoint and message type.
     * @param _eid The endpoint ID.
     * @param _msgType The OApp message type.
     * @param _extraOptions Additional options passed by the caller.
     * @return options The combination of caller specified options AND enforced options.
     */
    function combineOptions(
        uint32 _eid,
        uint16 _msgType,
        bytes calldata _extraOptions
    ) external view returns (bytes memory options);
}

src/lz/GasFloor.sol

// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.30;

// The two message types an OFT sends, which are the two keys its enforced options live under.
uint16 constant MSG_TYPE_SEND = 1;
uint16 constant MSG_TYPE_SEND_AND_CALL = 2;

// The most gas a floor may demand for `lzReceive`. An OFT credit costs well under a tenth of this
// on an EVM chain, and on Solana the field is compute units, where a whole transaction is capped
// at 1.4M. So this leaves room for a gas schedule to move a long way, and no room to price
// bridging out of reach.
uint128 constant MAX_LZ_RECEIVE_GAS = 1_000_000;

// The most native value a floor may attach to `lzReceive`, in the destination's smallest unit. It
// exists for Solana, where delivery has to fund the recipient's token account (about 2,040,000
// lamports); 10,000,000 lamports is 0.01 SOL. On an EVM destination the same number is 10^7 wei,
// which is nothing -- so one cap serves every route without knowing which is which.
uint128 constant MAX_LZ_RECEIVE_VALUE = 10_000_000;

/// @title GasFloor
/// @notice The one shape of LayerZero option a Pangea token may enforce: a single executor
///         `lzReceive` option, bounded.
///
/// WHY SO NARROW. Enforced options are prepended to every bridge transfer and paid for by the
/// sender, and LayerZero checks nothing about them beyond a two-byte type. So whoever may set them
/// could attach a native drop to an address of their own -- a toll on every transfer -- or demand
/// gas nobody can pay and stop bridging outright. A gas floor needs neither. What it needs is
/// "give `lzReceive` at least this much gas, and this much value", so that is all that is
/// accepted: no native drop, no compose option, no ordered execution, no second option, no DVN
/// option, and both numbers under hard caps.
///
/// THE ENCODING, from LayerZero's ExecutorOptions and OptionsBuilder:
///
///   uint16 3            options type 3
///   uint8  1            worker id: the executor
///   uint16 size         17 or 33 -- the option type byte plus the option
///   uint8  1            option type: lzReceive
///   uint128 gas
///   uint128 value       present only when size is 33
library GasFloor {
    error GasFloorOutOfRange(uint128 gas, uint128 value);
    error OptionsNotAGasFloor(bytes options);

    uint48 private constant HEADER_GAS_ONLY = 0x000301001101;
    uint48 private constant HEADER_GAS_AND_VALUE = 0x000301002101;

    function check(uint128 gas, uint128 value) internal pure {
        if (gas == 0 || gas > MAX_LZ_RECEIVE_GAS || value > MAX_LZ_RECEIVE_VALUE) {
            revert GasFloorOutOfRange(gas, value);
        }
    }

    /// @notice The options bytes for a floor. Byte for byte what
    ///         `OptionsBuilder.newOptions().addExecutorLzReceiveOption(gas, value)` produces.
    function encode(uint128 gas, uint128 value) internal pure returns (bytes memory) {
        check(gas, value);
        return value == 0
            ? abi.encodePacked(HEADER_GAS_ONLY, gas)
            : abi.encodePacked(HEADER_GAS_AND_VALUE, gas, value);
    }

    /// @notice Read a floor back out of options bytes, refusing anything that is not exactly one.
    function decode(bytes memory options) internal pure returns (uint128 gasLimit, uint128 value) {
        uint256 n = options.length;
        if (n != 22 && n != 38) revert OptionsNotAGasFloor(options);

        uint48 header;
        assembly {
            header := shr(208, mload(add(options, 32)))
            gasLimit := shr(128, mload(add(options, 38)))
        }
        if (header != (n == 22 ? HEADER_GAS_ONLY : HEADER_GAS_AND_VALUE)) revert OptionsNotAGasFloor(options);
        if (n == 38) {
            assembly {
                value := shr(128, mload(add(options, 54)))
            }
        }
        check(gasLimit, value);
    }
}

src/v2/LaunchOwnerV2.sol

// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.30;

import {EnforcedOptionParam} from
    "@layerzerolabs/oapp-evm/contracts/oapp/interfaces/IOAppOptionsType3.sol";
import {GasFloor, MSG_TYPE_SEND, MSG_TYPE_SEND_AND_CALL} from "../lz/GasFloor.sol";

interface IOwnedOApp {
    function setPeer(uint32 eid, bytes32 peer) external;
    function setEnforcedOptions(EnforcedOptionParam[] calldata enforcedOptions) external;
    function peers(uint32 eid) external view returns (bytes32);
}

/// @title LaunchOwner
/// @notice Owns one launch's OFT on one chain, and exists to take away the one power that could
///         undo the launch.
///
/// THE PROBLEM IT SOLVES. `setPeer` is owner-only, and a peer is an address on another chain
/// trusted to tell this token to mint. Whoever owns an OFT can therefore deploy a contract they
/// control on any LayerZero chain, register it as a peer, and mint themselves any amount. That
/// is unlimited supply, and it sits entirely outside "every token is in locked liquidity". It is
/// the one remaining way a launch here could rug, and it is true of every launch, so it needs a
/// platform-wide answer rather than a per-token promise.
///
/// WHY NOT JUST RENOUNCE. Renouncing closes the mint vector and also removes every ability to
/// operate the token. Enforced options are the gas floor for `lzReceive` on each route; if a
/// chain raises its gas costs and a token's floor is now too low, that token's bridging breaks
/// permanently, with no fix, and its five pools drift apart with no arbitrage to close them. A
/// deprecated DVN has the same shape. Renouncing trades a rug vector for a brick vector.
///
/// WHAT THIS DOES INSTEAD. Two owner powers can mint, and both are closed. `setPeer` names who may
/// tell the token to mint, so peers are writable until `seal()` and never again. `setDelegate`
/// names who chooses the verifiers that vouch for a peer's messages, and it is not exposed here at
/// all -- see below. What is left, enforced options, is operational and stays adjustable forever,
/// but only as a bounded gas floor: see `setEnforcedOptions`.
/// A factory launch seals at construction, so for those tokens the peer set is fixed from the block
/// the token exists in, publicly checkable -- `sealed_` is a bool anyone can read -- and the one
/// remaining power cannot create a single token.
///
/// WHY THERE IS NO `setDelegate`. There was one, described as unable to mint because "a message
/// still has to arrive from a registered peer". That was wrong. The delegate configures the
/// verifiers on the token's LayerZero routes, and a delegate that installs itself as the only
/// verifier can attest to a message nobody sent, in the name of a peer that is perfectly genuine.
/// Run against the live endpoint on Base, that minted a thousand times the supply of a sealed
/// token. So the delegate stays what the token's constructor made it -- the factory, which pins
/// every route during the launch and has no code to touch the endpoint afterwards -- and nothing
/// here can move it. The cost is that a route's verifiers can never be changed, which is the same
/// trade the peer seal makes and for the same reason.
///
/// SEALING IS ONE-WAY. There is no unseal, no admin override and no upgrade path, because any of
/// those would make the guarantee worthless: a guarantee that can be withdrawn is a promise.
/// @dev Factory v2's launch owner: LaunchOwner, plus one power held by the factory that made it --
///      `addPeer`, the owner side of the platform admin's "add a chain after launch" (owner decision
///      2026-10-22). It adds a peer for an endpoint id that has none, never changes or removes one,
///      and is callable by the factory alone, which calls it only from `addChain`, gated on the
///      factory's admin. The operator's powers are v1's. The v1 notes follow; where they say the
///      peer set is frozen, read: frozen except for chains the platform admin adds.
contract LaunchOwnerV2 {
    /// @notice The OFT this contract owns.
    IOwnedOApp public immutable oapp;

    /// @notice Wires the token, then operates it. The platform's multisig.
    address public admin;
    address public pendingAdmin;

    /// @notice Once true, no peer can ever be added, changed or removed.
    bool public sealed_;

    event PeerSet(uint32 indexed eid, bytes32 peer);
    event Sealed();
    event AdminProposed(address indexed from, address indexed to);
    event AdminChanged(address indexed from, address indexed to);

    error NotAdmin();
    error NotPending();
    error AlreadySealed();
    error ZeroAddress();
    error UnknownMessageType(uint16 msgType);

    /// @notice The factory that made this owner: the only caller of `addPeer`.
    address public immutable factory;

    event PeerAdded(uint32 indexed eid, bytes32 peer);

    error NotFactory();
    error PeerAlreadySet(uint32 eid, bytes32 peer);
    error ZeroPeer();

    /// @param sealNow Freeze the peer set at construction. The factory passes true: it wires
    ///        every peer itself while it still owns the token and then hands over an already
    ///        sealed owner, so the peers are set and frozen inside a single transaction and
    ///        there is never a block in which anyone could add one. Passing false leaves the
    ///        wiring phase open for a launch done by hand.
    /// @param factory_ The factory allowed to `addPeer`. v2 names it rather than taking the deployer:
    ///        a launch factory has this made by PartsDeployerV2, for size.
    constructor(address oapp_, address admin_, bool sealNow, address factory_) {
        if (oapp_ == address(0) || admin_ == address(0) || factory_ == address(0)) revert ZeroAddress();
        oapp = IOwnedOApp(oapp_);
        factory = factory_;
        admin = admin_;
        if (sealNow) {
            sealed_ = true;
            emit Sealed();
        }
    }

    modifier onlyAdmin() {
        if (msg.sender != admin) revert NotAdmin();
        _;
    }

    // ------------------------------------------------------------- wiring

    /// @notice Point this chain's token at its counterpart on another chain. Sealed-off forever
    ///         once the launch completes.
    function setPeer(uint32 eid, bytes32 peer) external onlyAdmin {
        if (sealed_) revert AlreadySealed();
        oapp.setPeer(eid, peer);
        emit PeerSet(eid, peer);
    }

    /// @notice Freeze the peer set permanently. The last step of a launch.
    /// @dev Deliberately takes no arguments and has no counterpart. Anyone can read `sealed_`
    ///      and `oapp.peers(eid)` to confirm which chains can mint this token and that the list
    ///      can no longer grow.
    function seal() external onlyAdmin {
        if (sealed_) revert AlreadySealed();
        sealed_ = true;
        emit Sealed();
    }

    // -------------------------------------------------------- operations

    /// @notice The gas floor for message delivery per route. Stays adjustable after sealing:
    ///         it cannot mint, and leaving it frozen is how a token gets bricked by a chain's
    ///         gas schedule changing underneath it.
    ///
    /// @dev A gas floor and nothing else. The token's own `setEnforcedOptions` stores whatever
    ///      bytes it is given, and those bytes are prepended to every transfer and paid for by
    ///      the sender -- so forwarding them unread let this role attach a native drop to itself
    ///      on every bridge transfer, or demand gas nobody could pay. Each entry must be exactly
    ///      one executor `lzReceive` option inside GasFloor's caps, for one of the two message
    ///      types an OFT sends.
    function setEnforcedOptions(EnforcedOptionParam[] calldata options) external onlyAdmin {
        for (uint256 i = 0; i < options.length; i++) {
            uint16 msgType = options[i].msgType;
            if (msgType != MSG_TYPE_SEND && msgType != MSG_TYPE_SEND_AND_CALL) revert UnknownMessageType(msgType);
            GasFloor.decode(options[i].options);
        }
        oapp.setEnforcedOptions(options);
    }

    // ------------------------------------------------------------- admin

    /// @dev Two-step. A mistyped admin on a sealed launch would leave the token permanently
    ///      unoperable, with no way to raise a gas floor it later needs.
    function proposeAdmin(address to) external onlyAdmin {
        if (to == address(0)) revert ZeroAddress();
        pendingAdmin = to;
        emit AdminProposed(admin, to);
    }

    function acceptAdmin() external {
        if (msg.sender != pendingAdmin) revert NotPending();
        emit AdminChanged(admin, msg.sender);
        admin = msg.sender;
        pendingAdmin = address(0);
    }

    /// @notice Add a peer for a chain the token has none on, with its gas floor. The factory only.
    /// @dev Refuses an endpoint id that already has a peer, so nothing launched can be repointed:
    ///      only a chain that was never part of the launch can be added. The floor is checked as
    ///      `setEnforcedOptions` checks it.
    function addPeer(uint32 eid, bytes32 peer, bytes calldata floor) external {
        if (msg.sender != factory) revert NotFactory();
        if (peer == bytes32(0)) revert ZeroPeer();
        bytes32 had = oapp.peers(eid);
        if (had != bytes32(0)) revert PeerAlreadySet(eid, had);
        GasFloor.decode(floor);
        oapp.setPeer(eid, peer);
        EnforcedOptionParam[] memory enforced = new EnforcedOptionParam[](2);
        enforced[0] = EnforcedOptionParam(eid, MSG_TYPE_SEND, floor);
        enforced[1] = EnforcedOptionParam(eid, MSG_TYPE_SEND_AND_CALL, floor);
        oapp.setEnforcedOptions(enforced);
        emit PeerAdded(eid, peer);
    }
}

src/v3/GasFloorV3.sol

// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.30;

import {MAX_LZ_RECEIVE_VALUE} from "../lz/GasFloor.sol";

// E6 (audit E5 M-A): the v3 gas floor's cap. A v3 receive priced from the price log (a V1-hook pool)
// needs up to 1,088,036 gas composed on an EVM chain (enforced 1,310,000: GapFloorsV3.sol), above
// GasFloor's 1,000,000. The v1/v2 cap (GasFloor.MAX_LZ_RECEIVE_GAS, used by LaunchOwner,
// LaunchOwnerV2 and the v1/v2 factories) is unchanged; only the v3 factory and LaunchOwnerV3 use this.
// 1,400,000: Solana's per-transaction compute limit (the same field is CU there), so no v3 floor can
// ask for gas no route could deliver.
uint128 constant MAX_LZ_RECEIVE_GAS_V3 = 1_400_000;

/// @title GasFloorV3 -- GasFloor (src/lz/GasFloor.sol) with the v3 gas cap
/// @notice Exactly GasFloor's one accepted option shape (a single executor lzReceive option, gas and
///         optional value, both bounded), byte for byte, and its errors (same selectors), with the gas
///         bounded by MAX_LZ_RECEIVE_GAS_V3 instead of MAX_LZ_RECEIVE_GAS.
library GasFloorV3 {
    error GasFloorOutOfRange(uint128 gas, uint128 value);
    error OptionsNotAGasFloor(bytes options);

    uint48 private constant HEADER_GAS_ONLY = 0x000301001101;
    uint48 private constant HEADER_GAS_AND_VALUE = 0x000301002101;

    function check(uint128 gas, uint128 value) internal pure {
        if (gas == 0 || gas > MAX_LZ_RECEIVE_GAS_V3 || value > MAX_LZ_RECEIVE_VALUE) {
            revert GasFloorOutOfRange(gas, value);
        }
    }

    function encode(uint128 gas, uint128 value) internal pure returns (bytes memory) {
        check(gas, value);
        return value == 0 ? abi.encodePacked(HEADER_GAS_ONLY, gas) : abi.encodePacked(HEADER_GAS_AND_VALUE, gas, value);
    }

    function decode(bytes memory options) internal pure returns (uint128 gasLimit, uint128 value) {
        uint256 n = options.length;
        if (n != 22 && n != 38) revert OptionsNotAGasFloor(options);
        uint48 header;
        assembly {
            header := shr(208, mload(add(options, 32)))
            gasLimit := shr(128, mload(add(options, 38)))
        }
        if (header != (n == 22 ? HEADER_GAS_ONLY : HEADER_GAS_AND_VALUE)) revert OptionsNotAGasFloor(options);
        if (n == 38) {
            assembly {
                value := shr(128, mload(add(options, 54)))
            }
        }
        check(gasLimit, value);
    }
}

src/v3/LaunchOwnerBaseV3.sol

// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.30;

import {EnforcedOptionParam} from
    "@layerzerolabs/oapp-evm/contracts/oapp/interfaces/IOAppOptionsType3.sol";
import {GasFloor, MSG_TYPE_SEND, MSG_TYPE_SEND_AND_CALL} from "../lz/GasFloor.sol";
import {IOwnedOApp} from "../v2/LaunchOwnerV2.sol";

// LaunchOwnerV3's own copy of LaunchOwnerV2 (xa-final-evm L-1, build-on-live). src/v2/LaunchOwnerV2.sol
// is a LIVE source: explorer verification of every v2 launch rebuilds it from the checkout and
// refuses a text whose keccak256 is not the one in the deployed build's metadata
// (script/verify-contracts.mjs standardJsonFromBuild). So the v2 file stays byte-identical to the
// live text, and the two `virtual`s LaunchOwnerV3 overrides live here instead. Same storage, events,
// errors and functions as LaunchOwnerV2; only the contract name and the two `virtual`s differ.

/// @title LaunchOwner
/// @notice Owns one launch's OFT on one chain, and exists to take away the one power that could
///         undo the launch.
///
/// THE PROBLEM IT SOLVES. `setPeer` is owner-only, and a peer is an address on another chain
/// trusted to tell this token to mint. Whoever owns an OFT can therefore deploy a contract they
/// control on any LayerZero chain, register it as a peer, and mint themselves any amount. That
/// is unlimited supply, and it sits entirely outside "every token is in locked liquidity". It is
/// the one remaining way a launch here could rug, and it is true of every launch, so it needs a
/// platform-wide answer rather than a per-token promise.
///
/// WHY NOT JUST RENOUNCE. Renouncing closes the mint vector and also removes every ability to
/// operate the token. Enforced options are the gas floor for `lzReceive` on each route; if a
/// chain raises its gas costs and a token's floor is now too low, that token's bridging breaks
/// permanently, with no fix, and its five pools drift apart with no arbitrage to close them. A
/// deprecated DVN has the same shape. Renouncing trades a rug vector for a brick vector.
///
/// WHAT THIS DOES INSTEAD. Two owner powers can mint, and both are closed. `setPeer` names who may
/// tell the token to mint, so peers are writable until `seal()` and never again. `setDelegate`
/// names who chooses the verifiers that vouch for a peer's messages, and it is not exposed here at
/// all -- see below. What is left, enforced options, is operational and stays adjustable forever,
/// but only as a bounded gas floor: see `setEnforcedOptions`.
/// A factory launch seals at construction, so for those tokens the peer set is fixed from the block
/// the token exists in, publicly checkable -- `sealed_` is a bool anyone can read -- and the one
/// remaining power cannot create a single token.
///
/// WHY THERE IS NO `setDelegate`. There was one, described as unable to mint because "a message
/// still has to arrive from a registered peer". That was wrong. The delegate configures the
/// verifiers on the token's LayerZero routes, and a delegate that installs itself as the only
/// verifier can attest to a message nobody sent, in the name of a peer that is perfectly genuine.
/// Run against the live endpoint on Base, that minted a thousand times the supply of a sealed
/// token. So the delegate stays what the token's constructor made it -- the factory, which pins
/// every route during the launch and has no code to touch the endpoint afterwards -- and nothing
/// here can move it. The cost is that a route's verifiers can never be changed, which is the same
/// trade the peer seal makes and for the same reason.
///
/// SEALING IS ONE-WAY. There is no unseal, no admin override and no upgrade path, because any of
/// those would make the guarantee worthless: a guarantee that can be withdrawn is a promise.
/// @dev Factory v2's launch owner: LaunchOwner, plus one power held by the factory that made it --
///      `addPeer`, the owner side of the platform admin's "add a chain after launch" (owner decision
///      2026-10-22). It adds a peer for an endpoint id that has none, never changes or removes one,
///      and is callable by the factory alone, which calls it only from `addChain`, gated on the
///      factory's admin. The operator's powers are v1's. The v1 notes follow; where they say the
///      peer set is frozen, read: frozen except for chains the platform admin adds.
abstract contract LaunchOwnerBaseV3 {
    /// @notice The OFT this contract owns.
    IOwnedOApp public immutable oapp;

    /// @notice Wires the token, then operates it. The platform's multisig.
    address public admin;
    address public pendingAdmin;

    /// @notice Once true, no peer can ever be added, changed or removed.
    bool public sealed_;

    event PeerSet(uint32 indexed eid, bytes32 peer);
    event Sealed();
    event AdminProposed(address indexed from, address indexed to);
    event AdminChanged(address indexed from, address indexed to);

    error NotAdmin();
    error NotPending();
    error AlreadySealed();
    error ZeroAddress();
    error UnknownMessageType(uint16 msgType);

    /// @notice The factory that made this owner: the only caller of `addPeer`.
    address public immutable factory;

    event PeerAdded(uint32 indexed eid, bytes32 peer);

    error NotFactory();
    error PeerAlreadySet(uint32 eid, bytes32 peer);
    error ZeroPeer();

    /// @param sealNow Freeze the peer set at construction. The factory passes true: it wires
    ///        every peer itself while it still owns the token and then hands over an already
    ///        sealed owner, so the peers are set and frozen inside a single transaction and
    ///        there is never a block in which anyone could add one. Passing false leaves the
    ///        wiring phase open for a launch done by hand.
    /// @param factory_ The factory allowed to `addPeer`. v2 names it rather than taking the deployer:
    ///        a launch factory has this made by PartsDeployerV2, for size.
    constructor(address oapp_, address admin_, bool sealNow, address factory_) {
        if (oapp_ == address(0) || admin_ == address(0) || factory_ == address(0)) revert ZeroAddress();
        oapp = IOwnedOApp(oapp_);
        factory = factory_;
        admin = admin_;
        if (sealNow) {
            sealed_ = true;
            emit Sealed();
        }
    }

    modifier onlyAdmin() {
        if (msg.sender != admin) revert NotAdmin();
        _;
    }

    // ------------------------------------------------------------- wiring

    /// @notice Point this chain's token at its counterpart on another chain. Sealed-off forever
    ///         once the launch completes.
    function setPeer(uint32 eid, bytes32 peer) external onlyAdmin {
        if (sealed_) revert AlreadySealed();
        oapp.setPeer(eid, peer);
        emit PeerSet(eid, peer);
    }

    /// @notice Freeze the peer set permanently. The last step of a launch.
    /// @dev Deliberately takes no arguments and has no counterpart. Anyone can read `sealed_`
    ///      and `oapp.peers(eid)` to confirm which chains can mint this token and that the list
    ///      can no longer grow.
    function seal() external onlyAdmin {
        if (sealed_) revert AlreadySealed();
        sealed_ = true;
        emit Sealed();
    }

    // -------------------------------------------------------- operations

    /// @notice The gas floor for message delivery per route. Stays adjustable after sealing:
    ///         it cannot mint, and leaving it frozen is how a token gets bricked by a chain's
    ///         gas schedule changing underneath it.
    ///
    /// @dev A gas floor and nothing else. The token's own `setEnforcedOptions` stores whatever
    ///      bytes it is given, and those bytes are prepended to every transfer and paid for by
    ///      the sender -- so forwarding them unread let this role attach a native drop to itself
    ///      on every bridge transfer, or demand gas nobody could pay. Each entry must be exactly
    ///      one executor `lzReceive` option inside GasFloor's caps, for one of the two message
    ///      types an OFT sends.
    function setEnforcedOptions(EnforcedOptionParam[] calldata options) external virtual onlyAdmin {
        for (uint256 i = 0; i < options.length; i++) {
            uint16 msgType = options[i].msgType;
            if (msgType != MSG_TYPE_SEND && msgType != MSG_TYPE_SEND_AND_CALL) revert UnknownMessageType(msgType);
            GasFloor.decode(options[i].options);
        }
        oapp.setEnforcedOptions(options);
    }

    // ------------------------------------------------------------- admin

    /// @dev Two-step. A mistyped admin on a sealed launch would leave the token permanently
    ///      unoperable, with no way to raise a gas floor it later needs.
    function proposeAdmin(address to) external onlyAdmin {
        if (to == address(0)) revert ZeroAddress();
        pendingAdmin = to;
        emit AdminProposed(admin, to);
    }

    function acceptAdmin() external {
        if (msg.sender != pendingAdmin) revert NotPending();
        emit AdminChanged(admin, msg.sender);
        admin = msg.sender;
        pendingAdmin = address(0);
    }

    /// @notice Add a peer for a chain the token has none on, with its gas floor. The factory only.
    /// @dev Refuses an endpoint id that already has a peer, so nothing launched can be repointed:
    ///      only a chain that was never part of the launch can be added. The floor is checked as
    ///      `setEnforcedOptions` checks it.
    function addPeer(uint32 eid, bytes32 peer, bytes calldata floor) external virtual {
        if (msg.sender != factory) revert NotFactory();
        if (peer == bytes32(0)) revert ZeroPeer();
        bytes32 had = oapp.peers(eid);
        if (had != bytes32(0)) revert PeerAlreadySet(eid, had);
        GasFloor.decode(floor);
        oapp.setPeer(eid, peer);
        EnforcedOptionParam[] memory enforced = new EnforcedOptionParam[](2);
        enforced[0] = EnforcedOptionParam(eid, MSG_TYPE_SEND, floor);
        enforced[1] = EnforcedOptionParam(eid, MSG_TYPE_SEND_AND_CALL, floor);
        oapp.setEnforcedOptions(enforced);
        emit PeerAdded(eid, peer);
    }
}
Compiler settingsShow
{
  "viaIR": true,
  "metadata": {
    "bytecodeHash": "ipfs"
  },
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "cancun",
  "remappings": [
    "@layerzerolabs/lz-evm-protocol-v2/=lib/layerzero/protocol-v2/",
    "@layerzerolabs/oapp-evm/=lib/layerzero/oapp-evm/",
    "@layerzerolabs/oft-evm/=lib/layerzero/oft-evm/",
    "@openzeppelin/=lib/openzeppelin-contracts/",
    "@uniswap/v4-core/=lib/uniswap-v4-core/",
    "ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
    "layerzero/=lib/layerzero/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "solmate/=lib/solmate/",
    "uniswap-v4-core/=lib/uniswap-v4-core/src/"
  ]
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.