Skip to content
Verified contractPartialMIT

FdcDVNFeeLibProxy

Address0x7b96a324d745ec8d2fd7b378bf7118c7a2e996de
Balance

0 ETH

 

Transactions

4

 

Compiler

solc 0.8.35

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.35+commit.47b9dedd
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,283,209
Creation transaction
0x870fc081b8…5b03e7b8c5
Proxy implementation
0x5cd0f759…99a58d9cFdcDVNFeeLib

contracts/dvn/implementation/FdcDVNFeeLibProxy.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.35;

import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
import {IIFdcDVNFeeLib} from "../interface/IIFdcDVNFeeLib.sol";

/**
 * @title FdcDVNFeeLibProxy
 * @notice ERC1967 UUPS proxy that initializes `FdcDVNFeeLib` and provides
 *         the stable address configured on the DVN; upgrades use the fee
 *         lib's owner-timelock path.
 * @custom:security-contact [email protected]
 */
contract FdcDVNFeeLibProxy is ERC1967Proxy {
    /**
     * @notice Deploys the proxy and forwards initialization to the
     *         implementation.
     * @param _implementation The `FdcDVNFeeLib` implementation address.
     * @param _initialOwner The initial owner (deployer during setup, then
     *        governance).
     * @param _config The initial pricing configuration (see
     *        `IIFdcDVNFeeLib.FeeLibConfig`).
     */
    constructor(
        address _implementation,
        address _initialOwner,
        IIFdcDVNFeeLib.FeeLibConfig memory _config
    )
        ERC1967Proxy(
            _implementation,
            abi.encodeCall(
                IIFdcDVNFeeLib.initialize,
                (
                    _initialOwner,
                    _config
                )
            )
        )
    {}
}

contracts/dvn/interface/IIFdcDVNFeeLib.sol

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4 <0.9;

import {IFdcDVNFeeLib} from "../../userInterfaces/IFdcDVNFeeLib.sol";

/**
 * @title IIFdcDVNFeeLib
 * @notice Internal interface for `FdcDVNFeeLib`: initialization and the
 *         owner-gated governance surface (destination configs and
 *         pricing-source wiring), on top of the user-facing `IFdcDVNFeeLib`.
 */
interface IIFdcDVNFeeLib is IFdcDVNFeeLib {

    /**
     * @notice Deployment configuration for `initialize`.
     * @param srcNativeDecimals Decimals of this chain's native token (1..36);
     *        fixed for the lifetime of the deployment (no setter).
     * @param priceFeed The LayerZero PriceFeed on this chain; zero disables
     *        quoting (fail closed). Settable later (`setPriceFeed`).
     * @param verifyGasUnits Execution gas of one destination `verifyPacket`,
     *        including the 21,000 transaction overhead and excluding calldata
     *        gas. Settable later (`setVerifyGas`).
     * @param verifyCallDataSize Worst-case `verifyPacket(proof)` calldata size
     *        in bytes. Settable later (`setVerifyGas`).
     * @param rootRelayGasUnits Execution gas of relaying one FDC Merkle root
     *        to a destination mirror `Relay`, on the same convention as
     *        `verifyGasUnits`: including the 21,000 transaction overhead and
     *        excluding calldata gas. Settable later (`setRootRelayGas`).
     * @param rootRelayCallDataSize Calldata size in bytes of one root relay.
     *        Settable later (`setRootRelayGas`).
     * @param fdcHomeEid LayerZero endpoint id of the chain whose canonical
     *        `Relay` already holds this deployment's FDC roots, exempting it
     *        from the root-relay term. It is the FDC instance's home - the same
     *        value across every fee lib in a mesh - which equals this chain's
     *        own eid on the home deployment and differs from it on a mirror.
     *        Zero exempts no destination. Fixed for the lifetime of the
     *        deployment (no setter).
     */
    // Initialization calldata only, never stored; field order follows the
    // storage variables it initializes rather than struct packing.
    // solhint-disable-next-line gas-struct-packing
    struct FeeLibConfig {
        uint8 srcNativeDecimals;
        address priceFeed;
        uint64 verifyGasUnits;
        uint32 verifyCallDataSize;
        uint64 rootRelayGasUnits;
        uint32 rootRelayCallDataSize;
        uint32 fdcHomeEid;
    }

    /**
     * @notice Initializes the proxy's owner and the pricing configuration.
     *         Callable once. Every field except `srcNativeDecimals` and
     *         `fdcHomeEid` keeps its setter for later tuning; initialization
     *         and the setters share the same validation.
     * @param _initialOwner The initial owner (governance; deployer during
     *        setup).
     * @param _config The pricing configuration.
     */
    function initialize(
        address _initialOwner,
        FeeLibConfig calldata _config
    )
        external;

    /**
     * @notice Sets (or updates) the pricing config for one or more
     *         destination chains. All-or-nothing: one bad entry reverts the
     *         batch, and a repeated eid within one batch leaves the last
     *         entry in force.
     * @param _dstEids LayerZero endpoint ids of the destination chains.
     * @dev Owner-timelocked: a mistyped `fixedUsd` mis-prices the route while
     *      every gate still passes.
     * @param _configs The configurations, positionally matching `_dstEids`.
     *        Each `fixedUsd` must be nonzero: it is the only margin over
     *        modelled gas cost, and its presence is what marks the
     *        destination as configured.
     */
    function setDstConfigs(
        uint32[] calldata _dstEids,
        DstConfig[] calldata _configs
    )
        external;

    /**
     * @notice Removes the pricing config of one or more destinations; quotes
     *         for them revert afterwards. All-or-nothing: an unpriced entry
     *         reverts the batch.
     * @param _dstEids LayerZero endpoint ids of the destination chains.
     */
    function removeDstConfigs(
        uint32[] calldata _dstEids
    )
        external;

    /**
     * @notice Sets the LayerZero PriceFeed the gas term is quoted from; zero
     *         clears it and disables quoting (fail closed).
     * @param _priceFeed The PriceFeed address on this chain.
     * @dev Owner-timelocked in both directions: installing a feed points
     *      pricing at a contract this repo cannot verify, and clearing one is
     *      therefore not an immediate lever either. The immediate send-side
     *      stops are `removeDstConfigs` per route and `removeMessageLibs`
     *      across the chain.
     */
    function setPriceFeed(
        address _priceFeed
    )
        external;

    /**
     * @notice Sets the gas inputs for one destination `verifyPacket`. Global
     *         values sized for the supported worst case rather than a
     *         per-destination measurement; revalidate when a target Relay or
     *         ULN implementation changes.
     * @dev Owner-timelocked; retuning is planned work, never urgent.
     * @param _gasUnits Execution gas; must be nonzero.
     * @param _callDataSize Worst-case calldata size in bytes; must be nonzero.
     */
    function setVerifyGas(
        uint64 _gasUnits,
        uint32 _callDataSize
    )
        external;

    /**
     * @notice Sets the gas inputs for relaying one FDC Merkle root to a
     *         destination mirror `Relay`. One root serves every packet in its
     *         voting round, so charging it per packet over-recovers as volume
     *         grows; lower these to amortize.
     * @dev Owner-timelocked; retuning is planned work, never urgent.
     * @param _gasUnits Execution gas on the PriceFeed's convention -
     *        including the 21,000 transaction overhead, excluding calldata
     *        gas, which it prices from `_callDataSize`. Must be nonzero.
     * @param _callDataSize Calldata size in bytes; must be nonzero.
     */
    function setRootRelayGas(
        uint64 _gasUnits,
        uint32 _callDataSize
    )
        external;
}

contracts/userInterfaces/IFdcDVNFeeLib.sol

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4 <0.9;

/**
 * @title IFdcDVNFeeLib
 * @notice Quotes one FDC DVN job in source-native wei as
 * `max(verifyFee + rootRelayFee, minFeeWei)
 *  + ceil(fixedUsd * 10^srcNativeDecimals * ratioDenominator
 *         / (1e18 * srcNativeUsd))`.
 * The floor guards the summed gas terms, before the USD term is added; the
 * USD division rounds up (full-precision `Math.mulDiv`, `Rounding.Ceil`).
 * Both gas terms are LayerZero PriceFeed estimates already converted to
 * source native: one for the destination `verifyPacket`, one for relaying an
 * FDC Merkle root to the destination.
 * Every live price input comes from LayerZero's PriceFeed - the rest
 * (`fixedUsd`, `minFeeWei`, the gas and calldata pairs, `srcNativeDecimals`,
 * `fdcHomeEid`) is this contract's own configuration. On the feed, its owner
 * or an approved updater writes the price snapshots and source-native USD
 * value, while the ratio denominator, per-destination fee model and
 * compression settings are owner-only, and the feed itself is upgradeable.
 * The root-relay term is skipped for the one destination equal to
 * `fdcHomeEid`, whose canonical `Relay` already holds the FDC root, so nothing
 * is relayed to it. Every other destination is assumed to need a relay.
 * `srcNativeUsd` is the PriceFeed's own `nativeTokenPriceUSD`, scaled by its
 * `priceRatioDenominator`.
 * Unconfigured destinations, zero gas quotes, and a zero USD price revert.
 * No PriceFeed input carries a timestamp, so staleness is not detectable
 * on-chain.
 */
interface IFdcDVNFeeLib {

    /**
     * @notice Pricing parameters for one destination chain.
     * @param fixedUsd Fixed fee component in USD, 1e18-scaled; covers the FDC
     *        attestation fee, the per-epoch signing-policy relay, and margin.
     *        Not the destination `Relay`'s protocol fee: this DVN is charged
     *        nothing for verification. Converted to source
     *        native at quote time. Must be nonzero: it is the only margin over
     *        modelled gas cost, and marks the destination as configured.
     * @param minFeeWei Floor on the summed gas legs, in source-native wei;
     *        the converted `fixedUsd` is added on top, so the quote never
     *        falls below `minFeeWei` plus the margin. Guards destinations
     *        whose modelled gas legs can collapse - a dropped or unset
     *        PriceFeed model, a zero L1 data entry - without letting the
     *        margin be absorbed into covering gas. Zero means no floor.
     */
    struct DstConfig {
        uint128 fixedUsd;
        uint128 minFeeWei;
    }

    /**
     * @notice Emitted when a destination's pricing config is set or updated.
     * @param dstEid LayerZero endpoint id of the destination chain.
     * @param config The configuration.
     */
    event DstConfigSet(
        uint32 indexed dstEid,
        DstConfig config
    );

    /**
     * @notice Emitted when a destination's pricing config is removed.
     * @param dstEid LayerZero endpoint id of the destination chain.
     */
    event DstConfigRemoved(
        uint32 indexed dstEid
    );

    /**
     * @notice Emitted when the LayerZero PriceFeed address is set or cleared.
     * @param priceFeed The PriceFeed address; zero disables quoting.
     */
    event PriceFeedSet(
        address indexed priceFeed
    );

    /**
     * @notice Emitted when the destination `verifyPacket` gas inputs are set.
     * @param gasUnits Execution gas of one `verifyPacket`.
     * @param callDataSize Worst-case `verifyPacket(proof)` calldata bytes.
     */
    event VerifyGasSet(
        uint64 gasUnits,
        uint32 callDataSize
    );

    /**
     * @notice Emitted when the Merkle-root relaying gas inputs are set.
     * @param gasUnits Execution gas of one root relay.
     * @param callDataSize Root-relay calldata bytes.
     */
    event RootRelayGasSet(
        uint64 gasUnits,
        uint32 callDataSize
    );

    /**
     * @notice Reverts when quoting a destination with no pricing config.
     * @param dstEid The unconfigured destination endpoint id.
     */
    error UnknownDst(
        uint32 dstEid
    );

    /**
     * @notice Reverts when a destination config has a zero eid or a zero
     *         `fixedUsd`, or when a gas config has zero gas units or calldata
     *         size.
     */
    error InvalidConfig();

    /**
     * @notice Reverts when a batch setter's parallel arrays differ in length.
     */
    error LengthMismatch();

    /**
     * @notice Reverts when the source native decimals are outside the
     *         supported range (1..36) at initialization.
     */
    error InvalidDecimals();

    /**
     * @notice Reverts when quoting while no LayerZero PriceFeed is configured.
     */
    error PriceFeedNotSet();

    /**
     * @notice Reverts when a gas leg returns a zero fee or a zero price ratio,
     *         or when the shared ratio denominator is zero — an unconfigured or
     *         broken destination entry that must not be quoted as free.
     * @param dstEid The destination endpoint id.
     */
    error InvalidGasQuote(
        uint32 dstEid
    );

    /**
     * @notice Reverts when the PriceFeed's source-native USD price is zero,
     *         i.e. unset or explicitly zeroed by its owner or an approved
     *         updater. The value carries no timestamp, so a stale nonzero
     *         price is not detectable.
     */
    error InvalidSrcUsdPrice();

    /**
     * @notice Reverts when DVN options are attached; no option type is
     *         supported, matching LayerZero's reference DVN fee lib.
     */
    error UnsupportedOptions();

    /**
     * @notice Reverts when the requested confirmations exceed FDC's `uint16`
     *         ceiling. Pricing does not depend on the count, but quoting a job
     *         no FDC proof could satisfy would be a misleading answer. The DVN
     *         bounds it too, so a quote made through the DVN never reaches this.
     * @param confirmations The requested confirmations.
     */
    error ConfirmationsExceedFdcMax(
        uint64 confirmations
    );

    /**
     * @notice Quotes the DVN fee for verifying a packet.
     * @param _dstEid LayerZero endpoint id of the destination chain.
     * @param _confirmations Source-chain confirmations requested for the job.
     *        Not a pricing input; rejected above FDC's `uint16` ceiling.
     * @param _sender The source OApp requesting the job (unused).
     * @param _options DVN options; must be empty. LayerZero routes these by
     *        the DVN's *index* in the OApp's config, so a non-empty value means
     *        an option reached this position - not that it was addressed to this
     *        DVN by identity. Rejected either way rather than silently
     *        discarded, since no option type is supported.
     * @return _fee Fee in source-chain native wei.
     */
    function getFee(
        uint32 _dstEid,
        uint64 _confirmations,
        address _sender,
        bytes calldata _options
    )
        external view
        returns (uint256 _fee);

    /**
     * @notice Returns the pricing config for a destination chain.
     * @param _dstEid LayerZero endpoint id of the destination chain.
     */
    function dstConfigs(
        uint32 _dstEid
    )
        external view
        returns (
            uint128 fixedUsd,
            uint128 minFeeWei
        );

    /**
     * @notice The destination endpoint ids currently priced. Enumerable so
     *         the supported destination set is an on-chain fact. Order is
     *         not stable across removals (swap-and-pop).
     * @return _dstEids The endpoint ids with a nonzero `dstConfigs` entry.
     */
    function getConfiguredDstEids() external view returns (uint32[] memory _dstEids);

    /**
     * @notice The LayerZero PriceFeed the gas term is quoted from (zero
     *         address when unset; quotes revert while unset).
     */
    function priceFeed() external view returns (address);

    /**
     * @notice Execution gas of one destination `verifyPacket`, including the
     *         21,000 transaction overhead and excluding calldata gas (the
     *         PriceFeed prices calldata separately). One global value sized
     *         for the supported worst case: the work is logically the same
     *         wherever the packet lands, though actual gas moves with the
     *         Relay and ULN implementations and the chain's own pricing.
     */
    function verifyGasUnits() external view returns (uint64);

    /**
     * @notice Worst-case ABI-encoded `verifyPacket(proof)` calldata size in
     *         bytes — the worker's proof-size ceiling.
     */
    function verifyCallDataSize() external view returns (uint32);

    /**
     * @notice Execution gas of relaying one FDC Merkle root to a destination
     *         mirror `Relay`, whose cost is dominated by signing-policy
     *         signature verification. Same PriceFeed convention as
     *         `verifyGasUnits`: include the 21,000 transaction overhead,
     *         exclude calldata gas.
     */
    function rootRelayGasUnits() external view returns (uint64);

    /**
     * @notice Calldata size in bytes of one root relay.
     */
    function rootRelayCallDataSize() external view returns (uint32);

    /**
     * @notice Decimals of the source chain's native token, fixed at
     *         initialization; used to convert `fixedUsd` to source native wei.
     */
    function srcNativeDecimals() external view returns (uint8);

    /**
     * @notice LayerZero endpoint id of the chain whose canonical `Relay`
     *         already holds this deployment's FDC roots. Quotes for that
     *         destination carry no root-relay term, since no relay happens.
     *         Fixed at initialization; zero exempts no destination.
     */
    function fdcHomeEid() external view returns (uint32);
}

dependencies/@openzeppelin-contracts-5.7.0/interfaces/IERC1967.sol

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

pragma solidity >=0.4.11;

/**
 * @dev ERC-1967: Proxy Storage Slots. This interface contains the events defined in the ERC.
 */
interface IERC1967 {
    /**
     * @dev Emitted when the implementation is upgraded.
     */
    event Upgraded(address indexed implementation);

    /**
     * @dev Emitted when the admin account has changed.
     */
    event AdminChanged(address previousAdmin, address newAdmin);

    /**
     * @dev Emitted when the beacon is changed.
     */
    event BeaconUpgraded(address indexed beacon);
}

dependencies/@openzeppelin-contracts-5.7.0/proxy/ERC1967/ERC1967Proxy.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.6.0) (proxy/ERC1967/ERC1967Proxy.sol)

pragma solidity ^0.8.22;

import {Proxy} from "../Proxy.sol";
import {ERC1967Utils} from "./ERC1967Utils.sol";

/**
 * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an
 * implementation address that can be changed. This address is stored in storage in the location specified by
 * https://eips.ethereum.org/EIPS/eip-1967[ERC-1967], so that it doesn't conflict with the storage layout of the
 * implementation behind the proxy.
 */
contract ERC1967Proxy is Proxy {
    /**
     * @dev The proxy is left uninitialized.
     */
    error ERC1967ProxyUninitialized();

    /**
     * @dev Initializes the upgradeable proxy with an initial implementation specified by `implementation`.
     *
     * Provided `_data` is passed in a delegate call to `implementation`. This will typically be an encoded function
     * call, and allows initializing the storage of the proxy like a Solidity constructor. By default construction
     * will fail if `_data` is empty. This behavior can be overridden using a custom {_unsafeAllowUninitialized} that
     * returns true. In that case, empty `_data` is ignored and no delegate call to the implementation is performed
     * during construction.
     *
     * Requirements:
     *
     * - If `data` is empty, `msg.value` must be zero.
     */
    constructor(address implementation, bytes memory _data) payable {
        if (!_unsafeAllowUninitialized() && _data.length == 0) {
            revert ERC1967ProxyUninitialized();
        }
        ERC1967Utils.upgradeToAndCall(implementation, _data);
    }

    /**
     * @dev Returns the current implementation address.
     *
     * TIP: To get this value clients can read directly from the storage slot shown below (specified by ERC-1967) using
     * the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.
     * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`
     */
    function _implementation() internal view virtual override returns (address) {
        return ERC1967Utils.getImplementation();
    }

    /**
     * @dev Returns whether the proxy can be left uninitialized.
     *
     * NOTE: Override this function to allow the proxy to be left uninitialized.
     * Consider uninitialized proxies might be susceptible to man-in-the-middle threats
     * where the proxy is replaced with a malicious one.
     */
    function _unsafeAllowUninitialized() internal pure virtual returns (bool) {
        return false;
    }
}

dependencies/@openzeppelin-contracts-5.7.0/proxy/ERC1967/ERC1967Utils.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.6.0) (proxy/ERC1967/ERC1967Utils.sol)

pragma solidity ^0.8.21;

import {IBeacon} from "../beacon/IBeacon.sol";
import {IERC1967} from "../../interfaces/IERC1967.sol";
import {Address} from "../../utils/Address.sol";
import {StorageSlot} from "../../utils/StorageSlot.sol";

/**
 * @dev This library provides getters and event emitting update functions for
 * https://eips.ethereum.org/EIPS/eip-1967[ERC-1967] slots.
 */
library ERC1967Utils {
    /**
     * @dev Storage slot with the address of the current implementation.
     * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;

    /**
     * @dev The `implementation` of the proxy is invalid.
     */
    error ERC1967InvalidImplementation(address implementation);

    /**
     * @dev The `admin` of the proxy is invalid.
     */
    error ERC1967InvalidAdmin(address admin);

    /**
     * @dev The `beacon` of the proxy is invalid.
     */
    error ERC1967InvalidBeacon(address beacon);

    /**
     * @dev An upgrade function sees `msg.value > 0` that may be lost.
     */
    error ERC1967NonPayable();

    /**
     * @dev Returns the current implementation address.
     */
    function getImplementation() internal view returns (address) {
        return StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value;
    }

    /**
     * @dev Stores a new address in the ERC-1967 implementation slot.
     */
    function _setImplementation(address newImplementation) private {
        if (newImplementation.code.length == 0) {
            revert ERC1967InvalidImplementation(newImplementation);
        }
        StorageSlot.getAddressSlot(IMPLEMENTATION_SLOT).value = newImplementation;
    }

    /**
     * @dev Performs implementation upgrade with additional setup call if data is nonempty.
     * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
     * to avoid stuck value in the contract.
     *
     * Emits an {IERC1967-Upgraded} event.
     */
    function upgradeToAndCall(address newImplementation, bytes memory data) internal {
        _setImplementation(newImplementation);
        emit IERC1967.Upgraded(newImplementation);

        if (data.length > 0) {
            Address.functionDelegateCall(newImplementation, data);
        } else {
            _checkNonPayable();
        }
    }

    /**
     * @dev Storage slot with the admin of the contract.
     * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;

    /**
     * @dev Returns the current admin.
     *
     * TIP: To get this value clients can read directly from the storage slot shown below (specified by ERC-1967) using
     * the https://ethereum.org/developers/docs/apis/json-rpc/#eth_getstorageat[`eth_getStorageAt`] RPC call.
     * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`
     */
    function getAdmin() internal view returns (address) {
        return StorageSlot.getAddressSlot(ADMIN_SLOT).value;
    }

    /**
     * @dev Stores a new address in the ERC-1967 admin slot.
     */
    function _setAdmin(address newAdmin) private {
        if (newAdmin == address(0)) {
            revert ERC1967InvalidAdmin(address(0));
        }
        StorageSlot.getAddressSlot(ADMIN_SLOT).value = newAdmin;
    }

    /**
     * @dev Changes the admin of the proxy.
     *
     * Emits an {IERC1967-AdminChanged} event.
     */
    function changeAdmin(address newAdmin) internal {
        emit IERC1967.AdminChanged(getAdmin(), newAdmin);
        _setAdmin(newAdmin);
    }

    /**
     * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
     * This is the keccak-256 hash of "eip1967.proxy.beacon" subtracted by 1.
     */
    // solhint-disable-next-line private-vars-leading-underscore
    bytes32 internal constant BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;

    /**
     * @dev Returns the current beacon.
     */
    function getBeacon() internal view returns (address) {
        return StorageSlot.getAddressSlot(BEACON_SLOT).value;
    }

    /**
     * @dev Stores a new beacon in the ERC-1967 beacon slot.
     */
    function _setBeacon(address newBeacon) private {
        if (newBeacon.code.length == 0) {
            revert ERC1967InvalidBeacon(newBeacon);
        }

        StorageSlot.getAddressSlot(BEACON_SLOT).value = newBeacon;

        address beaconImplementation = IBeacon(newBeacon).implementation();
        if (beaconImplementation.code.length == 0) {
            revert ERC1967InvalidImplementation(beaconImplementation);
        }
    }

    /**
     * @dev Change the beacon and trigger a setup call if data is nonempty.
     * This function is payable only if the setup call is performed, otherwise `msg.value` is rejected
     * to avoid stuck value in the contract.
     *
     * Emits an {IERC1967-BeaconUpgraded} event.
     *
     * CAUTION: Invoking this function has no effect on an instance of {BeaconProxy} since v5, since
     * it uses an immutable beacon without looking at the value of the ERC-1967 beacon slot for
     * efficiency.
     */
    function upgradeBeaconToAndCall(address newBeacon, bytes memory data) internal {
        _setBeacon(newBeacon);
        emit IERC1967.BeaconUpgraded(newBeacon);

        if (data.length > 0) {
            Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);
        } else {
            _checkNonPayable();
        }
    }

    /**
     * @dev Reverts if `msg.value` is not zero. It can be used to avoid `msg.value` stuck in the contract
     * if an upgrade doesn't perform an initialization call.
     */
    function _checkNonPayable() private {
        if (msg.value > 0) {
            revert ERC1967NonPayable();
        }
    }
}

dependencies/@openzeppelin-contracts-5.7.0/proxy/Proxy.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.5.0) (proxy/Proxy.sol)

pragma solidity ^0.8.20;

/**
 * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
 * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
 * be specified by overriding the virtual {_implementation} function.
 *
 * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
 * different contract through the {_delegate} function.
 *
 * The success and return data of the delegated call will be returned back to the caller of the proxy.
 */
abstract contract Proxy {
    /**
     * @dev Delegates the current call to `implementation`.
     *
     * This function does not return to its internal call site, it will return directly to the external caller.
     */
    function _delegate(address implementation) internal virtual {
        assembly {
            // Copy msg.data. We take full control of memory in this inline assembly
            // block because it will not return to Solidity code. We overwrite the
            // Solidity scratch pad at memory position 0.
            calldatacopy(0x00, 0x00, calldatasize())

            // Call the implementation.
            // out and outsize are 0 because we don't know the size yet.
            let result := delegatecall(gas(), implementation, 0x00, calldatasize(), 0x00, 0x00)

            // Copy the returned data.
            returndatacopy(0x00, 0x00, returndatasize())

            switch result
            // delegatecall returns 0 on error.
            case 0 {
                revert(0x00, returndatasize())
            }
            default {
                return(0x00, returndatasize())
            }
        }
    }

    /**
     * @dev This is a virtual function that should be overridden so it returns the address to which the fallback
     * function and {_fallback} should delegate.
     */
    function _implementation() internal view virtual returns (address);

    /**
     * @dev Delegates the current call to the address returned by `_implementation()`.
     *
     * This function does not return to its internal call site, it will return directly to the external caller.
     */
    function _fallback() internal virtual {
        _delegate(_implementation());
    }

    /**
     * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
     * function in the contract matches the call data.
     */
    fallback() external payable virtual {
        _fallback();
    }
}

dependencies/@openzeppelin-contracts-5.7.0/proxy/beacon/IBeacon.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (proxy/beacon/IBeacon.sol)

pragma solidity >=0.4.16;

/**
 * @dev This is the interface that {BeaconProxy} expects of its beacon.
 */
interface IBeacon {
    /**
     * @dev Must return an address that can be used as a delegate call target.
     *
     * {UpgradeableBeacon} will check that this address is a contract.
     */
    function implementation() external view returns (address);
}

dependencies/@openzeppelin-contracts-5.7.0/utils/Address.sol

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

pragma solidity ^0.8.20;

import {Errors} from "./Errors.sol";
import {LowLevelCall} from "./LowLevelCall.sol";

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

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

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert Errors.InsufficientBalance(address(this).balance, value);
        }
        bool success = LowLevelCall.callNoReturn(target, value, data);
        if (success && (LowLevelCall.returnDataSize() > 0 || target.code.length > 0)) {
            return LowLevelCall.returnData();
        } else if (success) {
            revert AddressEmptyCode(target);
        } else if (LowLevelCall.returnDataSize() > 0) {
            LowLevelCall.bubbleRevert();
        } else {
            revert Errors.FailedCall();
        }
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        bool success = LowLevelCall.staticcallNoReturn(target, data);
        if (success && (LowLevelCall.returnDataSize() > 0 || target.code.length > 0)) {
            return LowLevelCall.returnData();
        } else if (success) {
            revert AddressEmptyCode(target);
        } else if (LowLevelCall.returnDataSize() > 0) {
            LowLevelCall.bubbleRevert();
        } else {
            revert Errors.FailedCall();
        }
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        bool success = LowLevelCall.delegatecallNoReturn(target, data);
        if (success && (LowLevelCall.returnDataSize() > 0 || target.code.length > 0)) {
            return LowLevelCall.returnData();
        } else if (success) {
            revert AddressEmptyCode(target);
        } else if (LowLevelCall.returnDataSize() > 0) {
            LowLevelCall.bubbleRevert();
        } else {
            revert Errors.FailedCall();
        }
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {Errors.FailedCall}) in case
     * of an unsuccessful call.
     *
     * NOTE: This function is DEPRECATED and may be removed in the next major release.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        // only check if target is a contract if the call was successful and the return data is empty
        // otherwise we already know that it was a contract
        if (success && (returndata.length > 0 || target.code.length > 0)) {
            return returndata;
        } else if (success) {
            revert AddressEmptyCode(target);
        } else if (returndata.length > 0) {
            LowLevelCall.bubbleRevert(returndata);
        } else {
            revert Errors.FailedCall();
        }
    }

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

dependencies/@openzeppelin-contracts-5.7.0/utils/Errors.sol

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

pragma solidity ^0.8.20;

/**
 * @dev Collection of common custom errors used in multiple contracts
 *
 * IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.
 * It is recommended to avoid relying on the error API for critical functionality.
 *
 * _Available since v5.1._
 */
library Errors {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error InsufficientBalance(uint256 balance, uint256 needed);

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

    /**
     * @dev The deployment failed.
     */
    error FailedDeployment();

    /**
     * @dev A necessary precompile is missing.
     */
    error MissingPrecompile(address);
}

dependencies/@openzeppelin-contracts-5.7.0/utils/LowLevelCall.sol

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

pragma solidity ^0.8.20;

/**
 * @dev Library of low level call functions that implement different calling strategies to deal with the return data.
 *
 * WARNING: Using this library requires an advanced understanding of Solidity and how the EVM works. It is recommended
 * to use the {Address} library instead.
 */
library LowLevelCall {
    /// @dev Performs a Solidity function call using a low level `call` and ignoring the return data.
    function callNoReturn(address target, bytes memory data) internal returns (bool success) {
        return callNoReturn(target, 0, data);
    }

    /// @dev Same as {callNoReturn-address-bytes}, but allows specifying the value to be sent in the call.
    function callNoReturn(address target, uint256 value, bytes memory data) internal returns (bool success) {
        assembly ("memory-safe") {
            success := call(gas(), target, value, add(data, 0x20), mload(data), 0x00, 0x00)
        }
    }

    /// @dev Performs a Solidity function call using a low level `call` and returns the first 64 bytes of the result
    /// in the scratch space of memory. Useful for functions that return a tuple with two single-word values.
    ///
    /// WARNING: Do not assume that the results are zero if `success` is false. Memory can be already allocated
    /// and this function doesn't zero it out.
    function callReturn64Bytes(
        address target,
        bytes memory data
    ) internal returns (bool success, bytes32 result1, bytes32 result2) {
        return callReturn64Bytes(target, 0, data);
    }

    /// @dev Same as {callReturn64Bytes-address-bytes}, but allows specifying the value to be sent in the call.
    function callReturn64Bytes(
        address target,
        uint256 value,
        bytes memory data
    ) internal returns (bool success, bytes32 result1, bytes32 result2) {
        assembly ("memory-safe") {
            success := call(gas(), target, value, add(data, 0x20), mload(data), 0x00, 0x40)
            result1 := mload(0x00)
            result2 := mload(0x20)
        }
    }

    /// @dev Performs a Solidity function call using a low level `staticcall` and ignoring the return data.
    function staticcallNoReturn(address target, bytes memory data) internal view returns (bool success) {
        assembly ("memory-safe") {
            success := staticcall(gas(), target, add(data, 0x20), mload(data), 0x00, 0x00)
        }
    }

    /// @dev Performs a Solidity function call using a low level `staticcall` and returns the first 64 bytes of the result
    /// in the scratch space of memory. Useful for functions that return a tuple with two single-word values.
    ///
    /// WARNING: Do not assume that the results are zero if `success` is false. Memory can be already allocated
    /// and this function doesn't zero it out.
    function staticcallReturn64Bytes(
        address target,
        bytes memory data
    ) internal view returns (bool success, bytes32 result1, bytes32 result2) {
        assembly ("memory-safe") {
            success := staticcall(gas(), target, add(data, 0x20), mload(data), 0x00, 0x40)
            result1 := mload(0x00)
            result2 := mload(0x20)
        }
    }

    /// @dev Performs a Solidity function call using a low level `delegatecall` and ignoring the return data.
    function delegatecallNoReturn(address target, bytes memory data) internal returns (bool success) {
        assembly ("memory-safe") {
            success := delegatecall(gas(), target, add(data, 0x20), mload(data), 0x00, 0x00)
        }
    }

    /// @dev Performs a Solidity function call using a low level `delegatecall` and returns the first 64 bytes of the result
    /// in the scratch space of memory. Useful for functions that return a tuple with two single-word values.
    ///
    /// WARNING: Do not assume that the results are zero if `success` is false. Memory can be already allocated
    /// and this function doesn't zero it out.
    function delegatecallReturn64Bytes(
        address target,
        bytes memory data
    ) internal returns (bool success, bytes32 result1, bytes32 result2) {
        assembly ("memory-safe") {
            success := delegatecall(gas(), target, add(data, 0x20), mload(data), 0x00, 0x40)
            result1 := mload(0x00)
            result2 := mload(0x20)
        }
    }

    /// @dev Returns the size of the return data buffer.
    function returnDataSize() internal pure returns (uint256 size) {
        assembly ("memory-safe") {
            size := returndatasize()
        }
    }

    /// @dev Returns a buffer containing the return data from the last call.
    function returnData() internal pure returns (bytes memory result) {
        assembly ("memory-safe") {
            result := mload(0x40)
            mstore(result, returndatasize())
            returndatacopy(add(result, 0x20), 0x00, returndatasize())
            mstore(0x40, add(result, add(0x20, returndatasize())))
        }
    }

    /// @dev Revert with the return data from the last call.
    function bubbleRevert() internal pure {
        assembly ("memory-safe") {
            let fmp := mload(0x40)
            returndatacopy(fmp, 0x00, returndatasize())
            revert(fmp, returndatasize())
        }
    }

    function bubbleRevert(bytes memory returndata) internal pure {
        assembly ("memory-safe") {
            revert(add(returndata, 0x20), mload(returndata))
        }
    }
}

dependencies/@openzeppelin-contracts-5.7.0/utils/StorageSlot.sol

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

pragma solidity ^0.8.20;

/**
 * @dev Library for reading and writing primitive types to specific storage slots.
 *
 * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
 * This library helps with reading and writing to such slots without the need for inline assembly.
 *
 * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
 *
 * Example usage to set ERC-1967 implementation slot:
 * ```solidity
 * contract ERC1967 {
 *     // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.
 *     bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
 *
 *     function _getImplementation() internal view returns (address) {
 *         return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
 *     }
 *
 *     function _setImplementation(address newImplementation) internal {
 *         require(newImplementation.code.length > 0);
 *         StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
 *     }
 * }
 * ```
 *
 * TIP: Consider using this library along with {SlotDerivation}.
 */
library StorageSlot {
    struct AddressSlot {
        address value;
    }

    struct BooleanSlot {
        bool value;
    }

    struct Bytes32Slot {
        bytes32 value;
    }

    struct Uint256Slot {
        uint256 value;
    }

    struct Int256Slot {
        int256 value;
    }

    struct StringSlot {
        string value;
    }

    struct BytesSlot {
        bytes value;
    }

    /**
     * @dev Returns an `AddressSlot` with member `value` located at `slot`.
     */
    function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
        assembly ("memory-safe") {
            r.slot := slot
        }
    }

    /**
     * @dev Returns a `BooleanSlot` with member `value` located at `slot`.
     */
    function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
        assembly ("memory-safe") {
            r.slot := slot
        }
    }

    /**
     * @dev Returns a `Bytes32Slot` with member `value` located at `slot`.
     */
    function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
        assembly ("memory-safe") {
            r.slot := slot
        }
    }

    /**
     * @dev Returns a `Uint256Slot` with member `value` located at `slot`.
     */
    function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
        assembly ("memory-safe") {
            r.slot := slot
        }
    }

    /**
     * @dev Returns a `Int256Slot` with member `value` located at `slot`.
     */
    function getInt256Slot(bytes32 slot) internal pure returns (Int256Slot storage r) {
        assembly ("memory-safe") {
            r.slot := slot
        }
    }

    /**
     * @dev Returns a `StringSlot` with member `value` located at `slot`.
     */
    function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
        assembly ("memory-safe") {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `StringSlot` representation of the string storage pointer `store`.
     */
    function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
        assembly ("memory-safe") {
            r.slot := store.slot
        }
    }

    /**
     * @dev Returns a `BytesSlot` with member `value` located at `slot`.
     */
    function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
        assembly ("memory-safe") {
            r.slot := slot
        }
    }

    /**
     * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
     */
    function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
        assembly ("memory-safe") {
            r.slot := store.slot
        }
    }
}
Compiler settingsShow
{
  "viaIR": true,
  "metadata": {
    "appendCBOR": true,
    "bytecodeHash": "ipfs",
    "useLiteralContent": false
  },
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "cancun",
  "remappings": [
    "flare-periphery/=dependencies/flare-periphery-0.1.52/",
    "forge-std/=dependencies/forge-std-1.16.2/src/",
    "@openzeppelin/contracts/=dependencies/@openzeppelin-contracts-5.7.0/",
    "@openzeppelin/contracts-upgradeable/=dependencies/@openzeppelin-contracts-upgradeable-5.7.0/",
    "@layerzerolabs/lz-evm-protocol-v2/=dependencies/@layerzerolabs-lz-evm-protocol-v2-3.0.159/",
    "@layerzerolabs/lz-evm-messagelib-v2/=dependencies/@layerzerolabs-lz-evm-messagelib-v2-3.0.159/",
    "@layerzerolabs/oft-evm/=dependencies/@layerzerolabs-oft-evm-4.0.1/",
    "@layerzerolabs/oapp-evm/=dependencies/@layerzerolabs-oapp-evm-0.4.1/",
    "dependencies/@layerzerolabs-lz-evm-protocol-v2-3.0.159/:@openzeppelin/contracts/access/=test/vendor/openzeppelin-contracts-v4/access/",
    "dependencies/@layerzerolabs-lz-evm-protocol-v2-3.0.159/:@openzeppelin/contracts/access/=test/vendor/openzeppelin-contracts-v4/access/",
    "dependencies/@layerzerolabs-lz-evm-messagelib-v2-3.0.159/:@openzeppelin/contracts/access/=test/vendor/openzeppelin-contracts-v4/access/",
    "dependencies/@layerzerolabs-lz-evm-messagelib-v2-3.0.159/:@openzeppelin/contracts/access/=test/vendor/openzeppelin-contracts-v4/access/",
    "@layerzerolabs-lz-evm-messagelib-v2-3.0.159/=dependencies/@layerzerolabs-lz-evm-messagelib-v2-3.0.159/contracts/",
    "@layerzerolabs-lz-evm-protocol-v2-3.0.159/=dependencies/@layerzerolabs-lz-evm-protocol-v2-3.0.159/contracts/",
    "@layerzerolabs-oapp-evm-0.4.1/=dependencies/@layerzerolabs-oapp-evm-0.4.1/contracts/",
    "@layerzerolabs-oft-evm-4.0.1/=dependencies/@layerzerolabs-oft-evm-4.0.1/contracts/",
    "@openzeppelin-contracts-5.7.0/=dependencies/@openzeppelin-contracts-5.7.0/",
    "@openzeppelin-contracts-upgradeable-5.7.0/=dependencies/@openzeppelin-contracts-upgradeable-5.7.0/",
    "flare-periphery-0.1.52/=dependencies/flare-periphery-0.1.52/src/",
    "forge-std-1.16.2/=dependencies/forge-std-1.16.2/src/"
  ]
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.