Skip to content
Verified contractPartialUNLICENSED

PassPayment

Address0xcc1038b87ec6fb25a6fef5314a366acae31e0dc5
Balance

0 ETH

 

Transactions

2

 

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
UNLICENSED
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,329,892
Creation transaction
0xeeb5a853c2…9b88b6e649

src/pass/PassPayment.sol

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

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import {IERC20Permit} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Ownable2Step, Ownable} from "@openzeppelin/contracts/access/Ownable2Step.sol";
import {Pausable} from "@openzeppelin/contracts/utils/Pausable.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import {IEthUsdOracle} from "./IEthUsdOracle.sol";

/// @title PassPayment — the Ethereum side of the Battle Pass sale
/// @notice Buyers pay here, on Ethereum mainnet, in an allowlisted 6-decimal stablecoin (USDG, USDT, USDC) or in ETH
///         at an on-chain oracle price (Chainlink ETH/USD, bounded to an owner-set sane range).
///         Each pass number can be sold once; the numbers a buyer pays for are reserved in this contract's
///         bitmap in the same transaction the money moves. Proceeds take one hop — into this contract, then
///         on to the treasury Safe in the same transaction (or held for a permissionless `withdraw` when
///         forwarding is off). Nothing is minted here: the keeper watches `PassPaid`, waits for finality and
///         mints the soulbound pass on Robinhood Chain (`SeasonPass.keeperMint`) with `paymentRef` so a
///         payment can be fulfilled exactly once.
/// @dev Seasons mirror `SeasonPass`: the same id ranges, price and window are configured on both chains so a
///      number paid for here is a number the keeper can mint there. While this contract sells a season, the
///      direct mint paths on `SeasonPass` must stay closed (no sale window) — otherwise a number could be sold
///      here and minted there to different buyers. Not upgradeable; owner is a multisig.
contract PassPayment is Ownable2Step, Pausable, ReentrancyGuard {
    using SafeERC20 for IERC20;

    struct Season { uint32 firstId; uint32 lastId; uint64 saleStart; uint64 saleEnd; uint96 priceUsd6; }

    uint256 public constant MAX_IDS_PER_CALL = 50;
    /// @notice `payToken` in `PassPaid`/`PassSold` for ETH payments (the usual native-asset sentinel); `amount` is in wei.
    address public constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
    /// @notice Chain id the passes are minted on; part of every `paymentRef` so refs never collide across deployments.
    uint256 public immutable mintChainId;

    Season[] private _seasons;
    mapping(uint256 => uint256) private _sold;              // bitmap, word = id / 256
    mapping(uint256 => address) public buyerOf;             // who paid for an id
    mapping(address => bool) public isPayToken;             // 6-decimal stablecoins
    mapping(address => bool) public wasPayToken;            // ever accepted → never rescuable
    mapping(uint256 => uint256) public soldInSeason;
    mapping(address => uint256) public boughtBy;
    uint256 public paymentCount;                            // 1-based id of the last payment

    address public treasury;
    bool public forwardProceeds = true;
    uint32 public maxPerWallet;   // 0 = no limit
    uint32 public maxPerTx;       // 0 = no limit (MAX_IDS_PER_CALL still applies)

    /// @notice ETH/USD source for `payWithEth`; zero = ETH not accepted. Its answer must lie in [ethUsdMin6, ethUsdMax6].
    IEthUsdOracle public ethOracle;
    uint256 public ethUsdMin6;
    uint256 public ethUsdMax6;

    /// @notice One per payment. `paymentRef` = keccak256(abi.encode(block.chainid, address(this), paymentId, buyer, keccak256(abi.encodePacked(ids))))
    ///         is what the keeper passes to `SeasonPass.keeperMint`. Binding buyer + ids into the ref means a reorg that
    ///         rewinds `paymentCount` can never produce a second payment with the same ref (#86). `ids` is the full
    ///         list so the keeper needs no further reads.
    event PassPaid(uint256 indexed paymentId, address indexed buyer, address indexed payToken, uint256 amount, uint256[] ids, bytes32 paymentRef);
    /// @notice One per id, for the site's "number taken" view.
    event PassSold(address indexed buyer, uint256 indexed id, uint256 indexed paymentId, address payToken, uint256 perPass);
    event SeasonAdded(uint256 indexed season, uint32 firstId, uint32 lastId, uint96 priceUsd6, uint64 saleStart, uint64 saleEnd);
    event SaleUpdated(uint256 indexed season, uint96 priceUsd6, uint64 saleStart, uint64 saleEnd);
    event TreasuryUpdated(address treasury);
    event PayTokenSet(address indexed token, bool on);
    event ForwardingSet(bool on);
    event CapsSet(uint32 maxPerWallet, uint32 maxPerTx);
    event Withdrawn(address indexed token, address indexed to, uint256 amount);
    event Rescued(address indexed token, address indexed to, uint256 amount);
    event EthOracleSet(address oracle, uint256 minUsd6, uint256 maxUsd6);

    error ZeroAddress();
    error NoIds();
    error TooManyIds(uint256 count, uint256 max);
    error UnknownId(uint256 id);
    error AlreadySold(uint256 id);
    error DuplicateId(uint256 id);
    error SaleClosed(uint256 season, uint64 start, uint64 end);
    error NotPayToken(address token);
    error NotSixDecimals(address token);
    error WalletCap(uint32 cap);
    error TxCap(uint32 cap);
    error BadSeason();
    error PermitFailed();
    error CannotRescuePayToken(address token);
    error EthNotAccepted();
    error EthPriceOutOfRange(uint256 usd6, uint256 min6, uint256 max6);
    error InsufficientEth(uint256 required, uint256 sent);
    error EthTransferFailed();

    constructor(address treasury_, address owner_, uint256 mintChainId_) Ownable(owner_) {
        if (treasury_ == address(0) || owner_ == address(0)) revert ZeroAddress();
        if (mintChainId_ == 0) revert BadSeason();
        treasury = treasury_; mintChainId = mintChainId_;
    }

    // ------------------------------------------------------------------ seasons
    /// @notice Add a season: id range, stablecoin price (6 decimals) and sale window. Must match `SeasonPass.addSeason`.
    function addSeason(uint32 firstId, uint32 lastId, uint96 priceUsd6, uint64 saleStart, uint64 saleEnd) external onlyOwner returns (uint256 season) {
        if (firstId == 0 || lastId < firstId || saleEnd <= saleStart) revert BadSeason();
        if (_seasons.length > 0 && firstId <= _seasons[_seasons.length - 1].lastId) revert BadSeason();
        _seasons.push(Season(firstId, lastId, saleStart, saleEnd, priceUsd6));
        season = _seasons.length;
        emit SeasonAdded(season, firstId, lastId, priceUsd6, saleStart, saleEnd);
    }

    function setSale(uint256 season, uint96 priceUsd6, uint64 saleStart, uint64 saleEnd) external onlyOwner {
        Season storage s = _season(season);
        if (saleEnd <= saleStart) revert BadSeason();
        s.priceUsd6 = priceUsd6; s.saleStart = saleStart; s.saleEnd = saleEnd;
        emit SaleUpdated(season, priceUsd6, saleStart, saleEnd);
    }

    function seasonCount() external view returns (uint256) { return _seasons.length; }
    function season(uint256 n) external view returns (Season memory) { return _season(n); }
    /// @notice 1-based season of `id`; 0 when `id` belongs to no season.
    function seasonOf(uint256 id) public view returns (uint256) {
        for (uint256 i = 0; i < _seasons.length; i++) if (id >= _seasons[i].firstId && id <= _seasons[i].lastId) return i + 1;
        return 0;
    }
    function _season(uint256 n) internal view returns (Season storage) {
        if (n == 0 || n > _seasons.length) revert BadSeason();
        return _seasons[n - 1];
    }

    // ------------------------------------------------------------------ paying
    /// @notice Pay for `ids` at the fixed price in an allowlisted stablecoin. All or nothing. Needs an allowance
    ///         of exactly `price × ids.length` (USDT: approve; USDC/USDG: approve or `payWithPermit`).
    function pay(uint256[] calldata ids, address payToken) external nonReentrant whenNotPaused returns (uint256 paymentId) {
        return _pay(ids, payToken);
    }

    /// @notice `pay` with an EIP-2612 permit for the exact total (USDC, USDG), so approve + pay is one signature.
    function payWithPermit(uint256[] calldata ids, address payToken, uint256 deadline, uint8 v, bytes32 r, bytes32 s)
        external nonReentrant whenNotPaused returns (uint256 paymentId)
    {
        if (!isPayToken[payToken]) revert NotPayToken(payToken);
        uint256 total = uint256(_priceFor(ids)) * ids.length;
        // A front-run permit (same signature submitted by someone else) makes this revert while the allowance
        // already stands; tolerate that, as OpenZeppelin's SafeERC20.safePermit did.
        try IERC20Permit(payToken).permit(msg.sender, address(this), total, deadline, v, r, s) {} catch {
            if (IERC20(payToken).allowance(msg.sender, address(this)) < total) revert PermitFailed();
        }
        return _pay(ids, payToken);
    }

    function _pay(uint256[] calldata ids, address payToken) internal returns (uint256 paymentId) {
        if (!isPayToken[payToken]) revert NotPayToken(payToken);
        uint96 price = _reserve(ids, msg.sender);
        uint256 total = uint256(price) * ids.length;
        paymentId = ++paymentCount;
        for (uint256 i = 0; i < ids.length; i++) emit PassSold(msg.sender, ids[i], paymentId, payToken, price);
        emit PassPaid(paymentId, msg.sender, payToken, total, ids, paymentRef(paymentId, msg.sender, ids));
        // Effects are done; now the money. One hop: into this contract, then on to the treasury when forwarding.
        // Forward what actually arrived (a fee-on-transfer token delivers less), never more than this contract holds.
        uint256 before = IERC20(payToken).balanceOf(address(this));
        IERC20(payToken).safeTransferFrom(msg.sender, address(this), total);
        uint256 received = IERC20(payToken).balanceOf(address(this)) - before;
        if (forwardProceeds && received > 0) IERC20(payToken).safeTransfer(treasury, received);
    }

    /// @notice Pay for `ids` in ETH. The price is the season's dollar price converted at the oracle's ETH/USD at execution
    ///         time; send at least `quoteEth(ids)` (a little more covers price movement until inclusion) and the excess is
    ///         refunded in the same transaction — so `msg.value` is the buyer's slippage cap. The charged wei go on to the
    ///         treasury (or stay here for `withdrawEth` when forwarding is off).
    function payWithEth(uint256[] calldata ids) external payable nonReentrant whenNotPaused returns (uint256 paymentId) {
        uint96 price = _reserve(ids, msg.sender);
        uint256 usdTotal = uint256(price) * ids.length;
        uint256 total = _usdToWei(usdTotal);
        if (msg.value < total) revert InsufficientEth(total, msg.value);
        paymentId = ++paymentCount;
        uint256 perPass = total / ids.length;
        for (uint256 i = 0; i < ids.length; i++) emit PassSold(msg.sender, ids[i], paymentId, ETH, perPass);
        emit PassPaid(paymentId, msg.sender, ETH, total, ids, paymentRef(paymentId, msg.sender, ids));
        // Effects done. Treasury first, then the refund; both must succeed or the whole purchase reverts.
        if (forwardProceeds) _sendEth(treasury, total);
        if (msg.value > total) _sendEth(msg.sender, msg.value - total);
    }

    /// @notice Wei needed right now for `ids` (no reservation; reverts like `payWithEth` would on unknown ids / no oracle).
    function quoteEth(uint256[] calldata ids) external view returns (uint256) {
        return _usdToWei(uint256(_priceFor(ids)) * ids.length);
    }

    /// @notice Current oracle ETH/USD (6 decimals) after the sanity bounds; reverts when ETH is not accepted.
    function ethUsd6() public view returns (uint256 usd6) {
        if (address(ethOracle) == address(0)) revert EthNotAccepted();
        usd6 = ethOracle.ethUsd6();
        if (usd6 < ethUsdMin6 || usd6 > ethUsdMax6) revert EthPriceOutOfRange(usd6, ethUsdMin6, ethUsdMax6);
    }

    /// @dev usd6 × 1e18 / (usd6 per ETH), rounded up so the treasury never receives less than the dollar price.
    function _usdToWei(uint256 usd6) internal view returns (uint256) {
        uint256 px = ethUsd6();
        return (usd6 * 1e18 + px - 1) / px;
    }

    function _sendEth(address to, uint256 amount) internal {
        (bool ok,) = payable(to).call{value: amount}("");
        if (!ok) revert EthTransferFailed();
    }

    /// @notice The idempotency key the keeper hands to `SeasonPass.keeperMint`: bound to the payment counter, the buyer and
    ///         the exact id list, so no two distinct payments can share it even across a chain reorg.
    function paymentRef(uint256 paymentId, address buyer, uint256[] calldata ids) public view returns (bytes32) {
        return keccak256(abi.encode(block.chainid, address(this), paymentId, buyer, keccak256(abi.encodePacked(ids))));
    }

    // ------------------------------------------------------------------ internals
    /// @dev Validate `ids` (one season, in window, unsold, distinct, within caps) and mark them sold.
    function _reserve(uint256[] calldata ids, address buyer) internal returns (uint96 price) {
        uint256 n = ids.length;
        if (n == 0) revert NoIds();
        if (n > MAX_IDS_PER_CALL) revert TooManyIds(n, MAX_IDS_PER_CALL);
        if (maxPerTx != 0 && n > maxPerTx) revert TxCap(maxPerTx);
        if (maxPerWallet != 0 && boughtBy[buyer] + n > maxPerWallet) revert WalletCap(maxPerWallet);
        uint256 seasonId = seasonOf(ids[0]);
        if (seasonId == 0) revert UnknownId(ids[0]);
        Season storage s = _seasons[seasonId - 1];
        if (block.timestamp < s.saleStart || block.timestamp > s.saleEnd) revert SaleClosed(seasonId, s.saleStart, s.saleEnd);
        for (uint256 i = 0; i < n; i++) {
            uint256 id = ids[i];
            if (seasonOf(id) != seasonId) revert UnknownId(id);
            (uint256 word, uint256 bit) = (id >> 8, 1 << (id & 255));
            if (_sold[word] & bit != 0) {
                if (_inArray(ids, id, i)) revert DuplicateId(id);
                revert AlreadySold(id);
            }
            _sold[word] |= bit;
            buyerOf[id] = buyer;
        }
        soldInSeason[seasonId] += n;
        boughtBy[buyer] += n;
        price = s.priceUsd6;
    }

    /// @dev Price without reserving — for the permit total. Reverts the same way `_reserve` would on an unknown id.
    function _priceFor(uint256[] calldata ids) internal view returns (uint96) {
        if (ids.length == 0) revert NoIds();
        uint256 seasonId = seasonOf(ids[0]);
        if (seasonId == 0) revert UnknownId(ids[0]);
        return _seasons[seasonId - 1].priceUsd6;
    }

    function _inArray(uint256[] calldata ids, uint256 id, uint256 before) internal pure returns (bool) {
        for (uint256 j = 0; j < before; j++) if (ids[j] == id) return true;
        return false;
    }

    // ------------------------------------------------------------------ reads
    function isSold(uint256 id) public view returns (bool) { return _sold[id >> 8] & (1 << (id & 255)) != 0; }
    /// @notice One bit per id for the season, little-endian within each 256-bit word, word 0 = ids 0–255.
    ///         Same layout as `SeasonPass.mintedBitmap`, so the site can OR the two.
    function soldBitmap(uint256 n) external view returns (uint256[] memory words) {
        Season storage s = _season(n);
        uint256 w0 = s.firstId >> 8; uint256 w1 = s.lastId >> 8;
        words = new uint256[](w1 - w0 + 1);
        for (uint256 w = w0; w <= w1; w++) words[w - w0] = _sold[w];
    }
    function totalSold(uint256 n) external view returns (uint256) { return soldInSeason[n]; }
    function remaining(uint256 n) external view returns (uint256) { Season storage s = _season(n); return (s.lastId - s.firstId + 1) - soldInSeason[n]; }
    function price(uint256 n) external view returns (uint96) { return _season(n).priceUsd6; }
    function saleWindow(uint256 n) external view returns (uint64, uint64) { Season storage s = _season(n); return (s.saleStart, s.saleEnd); }

    // ------------------------------------------------------------------ owner controls
    function pause() external onlyOwner { _pause(); }
    function unpause() external onlyOwner { _unpause(); }
    function setTreasury(address t) external onlyOwner { if (t == address(0)) revert ZeroAddress(); treasury = t; emit TreasuryUpdated(t); }
    /// @notice Allow or remove a payment token. Prices are 6-decimal dollars, so the token must be too.
    function setPayToken(address token, bool on) external onlyOwner {
        if (token == address(0)) revert ZeroAddress();
        if (on && IERC20Metadata(token).decimals() != 6) revert NotSixDecimals(token);
        isPayToken[token] = on; emit PayTokenSet(token, on);
        if (on) wasPayToken[token] = true;
    }
    function setForwarding(bool on) external onlyOwner { forwardProceeds = on; emit ForwardingSet(on); }
    /// @notice Accept ETH at `oracle`'s price, only while it reports within [minUsd6, maxUsd6]. `oracle` = 0 stops ETH.
    function setEthOracle(address oracle, uint256 minUsd6, uint256 maxUsd6) external onlyOwner {
        if (oracle != address(0) && (minUsd6 == 0 || maxUsd6 <= minUsd6)) revert BadSeason();
        ethOracle = IEthUsdOracle(oracle); ethUsdMin6 = minUsd6; ethUsdMax6 = maxUsd6;
        emit EthOracleSet(oracle, minUsd6, maxUsd6);
    }
    function setCaps(uint32 perWallet, uint32 perTx) external onlyOwner { maxPerWallet = perWallet; maxPerTx = perTx; emit CapsSet(perWallet, perTx); }

    /// @notice Send held proceeds (forwarding off) to the treasury. Anyone may call; the destination is fixed.
    function withdraw(address token) external nonReentrant returns (uint256 amount) {
        if (!isPayToken[token] && !wasPayToken[token]) revert NotPayToken(token);
        amount = IERC20(token).balanceOf(address(this));
        if (amount > 0) IERC20(token).safeTransfer(treasury, amount);
        emit Withdrawn(token, treasury, amount);
    }

    /// @notice Send held ETH proceeds (forwarding off) to the treasury. Anyone may call; the destination is fixed.
    function withdrawEth() external nonReentrant returns (uint256 amount) {
        amount = address(this).balance;
        if (amount > 0) _sendEth(treasury, amount);
        emit Withdrawn(ETH, treasury, amount);
    }

    /// @notice Return tokens sent here by mistake. Never a token that was EVER a payment token: those only go to the treasury.
    function rescue(address token, address to) external onlyOwner returns (uint256 amount) {
        if (isPayToken[token] || wasPayToken[token]) revert CannotRescuePayToken(token);
        if (to == address(0)) revert ZeroAddress();
        amount = IERC20(token).balanceOf(address(this));
        IERC20(token).safeTransfer(to, amount);
        emit Rescued(token, to, amount);
    }
}

lib/openzeppelin-contracts/contracts/access/Ownable.sol

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

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

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

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

lib/openzeppelin-contracts/contracts/access/Ownable2Step.sol

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

pragma solidity ^0.8.20;

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

/**
 * @dev Contract module which provides access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * This extension of the {Ownable} contract includes a two-step mechanism to transfer
 * ownership, where the new owner must call {acceptOwnership} in order to replace the
 * old one. This can help prevent common mistakes, such as transfers of ownership to
 * incorrect accounts, or to contracts that are unable to interact with the
 * permission system.
 *
 * The initial owner is specified at deployment time in the constructor for `Ownable`. This
 * can later be changed with {transferOwnership} and {acceptOwnership}.
 *
 * This module is used through inheritance. It will make available all functions
 * from parent (Ownable).
 */
abstract contract Ownable2Step is Ownable {
    address private _pendingOwner;

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

    /**
     * @dev Returns the address of the pending owner.
     */
    function pendingOwner() public view virtual returns (address) {
        return _pendingOwner;
    }

    /**
     * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
     * Can only be called by the current owner.
     *
     * Setting `newOwner` to the zero address is allowed; this can be used to cancel an initiated ownership transfer.
     */
    function transferOwnership(address newOwner) public virtual override onlyOwner {
        _pendingOwner = newOwner;
        emit OwnershipTransferStarted(owner(), newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual override {
        delete _pendingOwner;
        super._transferOwnership(newOwner);
    }

    /**
     * @dev The new owner accepts the ownership transfer.
     */
    function acceptOwnership() public virtual {
        address sender = _msgSender();
        if (pendingOwner() != sender) {
            revert OwnableUnauthorizedAccount(sender);
        }
        _transferOwnership(sender);
    }
}

lib/openzeppelin-contracts/contracts/interfaces/IERC1363.sol

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

pragma solidity >=0.6.2;

import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";

/**
 * @title IERC1363
 * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
 *
 * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
 * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
 */
interface IERC1363 is IERC20, IERC165 {
    /*
     * Note: the ERC-165 identifier for this interface is 0xb0202a11.
     * 0xb0202a11 ===
     *   bytes4(keccak256('transferAndCall(address,uint256)')) ^
     *   bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
     */

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @param data Additional data with no specified format, sent in call to `spender`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}

lib/openzeppelin-contracts/contracts/interfaces/IERC165.sol

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

pragma solidity >=0.4.16;

import {IERC165} from "../utils/introspection/IERC165.sol";

lib/openzeppelin-contracts/contracts/interfaces/IERC20.sol

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

pragma solidity >=0.4.16;

import {IERC20} from "../token/ERC20/IERC20.sol";

lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol

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

pragma solidity >=0.4.16;

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

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

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

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

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

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

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

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

lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol

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

pragma solidity >=0.6.2;

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

/**
 * @dev Interface for the optional metadata functions from the ERC-20 standard.
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Permit.sol

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

pragma solidity >=0.4.16;

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

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

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

lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol

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

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";

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

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

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

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

    /**
     * @dev Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.
     */
    function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {
        return _callOptionalReturnBool(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.
     */
    function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {
        return _callOptionalReturnBool(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     *
     * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
     * only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
     * set here.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

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

    /**
     * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            safeTransfer(token, to, value);
        } else if (!token.transferAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
     * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferFromAndCallRelaxed(
        IERC1363 token,
        address from,
        address to,
        uint256 value,
        bytes memory data
    ) internal {
        if (to.code.length == 0) {
            safeTransferFrom(token, from, to, value);
        } else if (!token.transferFromAndCall(from, to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
     * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
     * once without retrying, and relies on the returned value to be true.
     *
     * Reverts if the returned value is other than `true`.
     */
    function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            forceApprove(token, to, value);
        } else if (!token.approveAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            // bubble errors
            if iszero(success) {
                let ptr := mload(0x40)
                returndatacopy(ptr, 0, returndatasize())
                revert(ptr, returndatasize())
            }
            returnSize := returndatasize()
            returnValue := mload(0)
        }

        if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silently catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        bool success;
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            returnSize := returndatasize()
            returnValue := mload(0)
        }
        return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
    }
}

lib/openzeppelin-contracts/contracts/utils/Context.sol

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

pragma solidity ^0.8.20;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

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

lib/openzeppelin-contracts/contracts/utils/Pausable.sol

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

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    bool private _paused;

    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    /**
     * @dev The operation failed because the contract is paused.
     */
    error EnforcedPause();

    /**
     * @dev The operation failed because the contract is not paused.
     */
    error ExpectedPause();

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        if (paused()) {
            revert EnforcedPause();
        }
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        if (!paused()) {
            revert ExpectedPause();
        }
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

lib/openzeppelin-contracts/contracts/utils/ReentrancyGuard.sol

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

pragma solidity ^0.8.20;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at,
 * consider using {ReentrancyGuardTransient} instead.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant NOT_ENTERED = 1;
    uint256 private constant ENTERED = 2;

    uint256 private _status;

    /**
     * @dev Unauthorized reentrant call.
     */
    error ReentrancyGuardReentrantCall();

    constructor() {
        _status = NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be NOT_ENTERED
        if (_status == ENTERED) {
            revert ReentrancyGuardReentrantCall();
        }

        // Any calls to nonReentrant after this point will fail
        _status = ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = NOT_ENTERED;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == ENTERED;
    }
}

lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol

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

pragma solidity >=0.4.16;

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

src/pass/IEthUsdOracle.sol

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

/// @notice ETH priced in 6-decimal dollars. `PassPayment` only depends on this.
interface IEthUsdOracle {
    /// @return usd6 dollars (6 decimals) per 1 ETH
    function ethUsd6() external view returns (uint256 usd6);
}
Compiler settingsShow
{
  "viaIR": true,
  "metadata": {
    "appendCBOR": true,
    "bytecodeHash": "ipfs",
    "useLiteralContent": false
  },
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "cancun",
  "remappings": [
    "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "@uniswap/v4-core/=lib/v4-periphery/lib/v4-core/",
    "@uniswap/v4-periphery/=lib/v4-periphery/",
    "uniswap-hooks/=lib/uniswap-hooks/",
    "permit2/=lib/v4-periphery/lib/permit2/",
    "forge-std/=lib/forge-std/src/",
    "solmate/=lib/v4-periphery/lib/v4-core/lib/solmate/",
    "lib/uniswap-hooks/lib/v4-periphery/lib/permit2/lib/forge-gas-snapshot/lib/forge-std/:ds-test/=lib/uniswap-hooks/lib/v4-periphery/lib/permit2/lib/forge-gas-snapshot/lib/forge-std/lib/ds-test/src/",
    "lib/uniswap-hooks/lib/v4-periphery/lib/permit2/lib/forge-gas-snapshot/lib/forge-std/:ds-test/=lib/uniswap-hooks/lib/v4-periphery/lib/permit2/lib/forge-gas-snapshot/lib/forge-std/lib/ds-test/src/",
    "lib/uniswap-hooks/lib/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=lib/uniswap-hooks/lib/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
    "lib/uniswap-hooks/lib/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=lib/uniswap-hooks/lib/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
    "lib/uniswap-hooks/lib/v4-core/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=lib/uniswap-hooks/lib/v4-core/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
    "lib/uniswap-hooks/lib/v4-core/lib/openzeppelin-contracts/lib/forge-std/:ds-test/=lib/uniswap-hooks/lib/v4-core/lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
    "lib/uniswap-hooks/lib/v4-periphery/lib/permit2/lib/forge-std/:ds-test/=lib/uniswap-hooks/lib/v4-periphery/lib/permit2/lib/forge-std/lib/ds-test/src/",
    "lib/uniswap-hooks/lib/v4-periphery/lib/permit2/lib/forge-std/:ds-test/=lib/uniswap-hooks/lib/v4-periphery/lib/permit2/lib/forge-std/lib/ds-test/src/",
    "lib/uniswap-hooks/lib/v4-periphery/lib/permit2/lib/solmate/:ds-test/=lib/uniswap-hooks/lib/v4-periphery/lib/permit2/lib/solmate/lib/ds-test/src/",
    "lib/uniswap-hooks/lib/v4-periphery/lib/permit2/lib/solmate/:ds-test/=lib/uniswap-hooks/lib/v4-periphery/lib/permit2/lib/solmate/lib/ds-test/src/",
    "lib/uniswap-hooks/lib/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/:erc4626-tests/=lib/uniswap-hooks/lib/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/lib/erc4626-tests/",
    "lib/uniswap-hooks/lib/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/:erc4626-tests/=lib/uniswap-hooks/lib/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/lib/erc4626-tests/",
    "lib/uniswap-hooks/lib/v4-periphery/lib/v4-core/lib/solmate/:ds-test/=lib/uniswap-hooks/lib/v4-periphery/lib/v4-core/lib/solmate/lib/ds-test/src/",
    "lib/uniswap-hooks/lib/v4-periphery/lib/v4-core/lib/solmate/:ds-test/=lib/uniswap-hooks/lib/v4-periphery/lib/v4-core/lib/solmate/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/uniswap-hooks/lib/v4-core/lib/openzeppelin-contracts/:erc4626-tests/=lib/uniswap-hooks/lib/v4-core/lib/openzeppelin-contracts/lib/erc4626-tests/",
    "lib/uniswap-hooks/lib/v4-core/lib/openzeppelin-contracts/:erc4626-tests/=lib/uniswap-hooks/lib/v4-core/lib/openzeppelin-contracts/lib/erc4626-tests/",
    "lib/uniswap-hooks/lib/v4-core/lib/solmate/:ds-test/=lib/uniswap-hooks/lib/v4-core/lib/solmate/lib/ds-test/src/",
    "lib/uniswap-hooks/lib/v4-core/lib/solmate/:ds-test/=lib/uniswap-hooks/lib/v4-core/lib/solmate/lib/ds-test/src/",
    "lib/uniswap-hooks/lib/v4-periphery/lib/permit2/:forge-gas-snapshot/=lib/uniswap-hooks/lib/v4-periphery/lib/permit2/lib/forge-gas-snapshot/src/",
    "lib/uniswap-hooks/lib/v4-periphery/lib/permit2/:forge-gas-snapshot/=lib/uniswap-hooks/lib/v4-periphery/lib/permit2/lib/forge-gas-snapshot/src/",
    "lib/uniswap-hooks/lib/v4-periphery/lib/permit2/:openzeppelin-contracts/=lib/uniswap-hooks/lib/v4-periphery/lib/permit2/lib/openzeppelin-contracts/",
    "lib/uniswap-hooks/lib/v4-periphery/lib/permit2/:openzeppelin-contracts/=lib/uniswap-hooks/lib/v4-periphery/lib/permit2/lib/openzeppelin-contracts/",
    "lib/uniswap-hooks/lib/v4-periphery/lib/v4-core/:openzeppelin-contracts/=lib/uniswap-hooks/lib/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/",
    "lib/uniswap-hooks/lib/v4-periphery/lib/v4-core/:openzeppelin-contracts/=lib/uniswap-hooks/lib/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/",
    "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/uniswap-hooks/lib/openzeppelin-contracts/:erc4626-tests/=lib/uniswap-hooks/lib/openzeppelin-contracts/lib/erc4626-tests/",
    "lib/uniswap-hooks/lib/openzeppelin-contracts/:erc4626-tests/=lib/uniswap-hooks/lib/openzeppelin-contracts/lib/erc4626-tests/",
    "lib/uniswap-hooks/lib/openzeppelin-contracts/:halmos-cheatcodes/=lib/uniswap-hooks/lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
    "lib/uniswap-hooks/lib/openzeppelin-contracts/:halmos-cheatcodes/=lib/uniswap-hooks/lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
    "lib/uniswap-hooks/lib/v4-core/:openzeppelin-contracts/=lib/uniswap-hooks/lib/v4-core/lib/openzeppelin-contracts/",
    "lib/uniswap-hooks/lib/v4-core/:openzeppelin-contracts/=lib/uniswap-hooks/lib/v4-core/lib/openzeppelin-contracts/",
    "lib/uniswap-hooks/lib/v4-periphery/:v4-core/=lib/uniswap-hooks/lib/v4-periphery/lib/v4-core/src/",
    "lib/uniswap-hooks/lib/v4-periphery/:v4-core/=lib/uniswap-hooks/lib/v4-periphery/lib/v4-core/src/",
    "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/: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/openzeppelin-contracts/:erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "lib/openzeppelin-contracts/:erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "lib/openzeppelin-contracts/:halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
    "lib/openzeppelin-contracts/:halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
    "lib/uniswap-hooks/:openzeppelin-contracts/=lib/uniswap-hooks/lib/openzeppelin-contracts/",
    "lib/uniswap-hooks/:openzeppelin-contracts/=lib/uniswap-hooks/lib/openzeppelin-contracts/",
    "lib/uniswap-hooks/:v4-core/=lib/uniswap-hooks/lib/v4-core/src/",
    "lib/uniswap-hooks/:v4-core/=lib/uniswap-hooks/lib/v4-core/src/",
    "lib/uniswap-hooks/:v4-periphery/=lib/uniswap-hooks/lib/v4-periphery/",
    "lib/uniswap-hooks/:v4-periphery/=lib/uniswap-hooks/lib/v4-periphery/",
    "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/uniswap-hooks/lib/v4-core/node_modules/@ensdomains/",
    "@openzeppelin/=lib/uniswap-hooks/lib/v4-core/lib/openzeppelin-contracts/",
    "ds-test/=lib/uniswap-hooks/lib/v4-core/lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "forge-gas-snapshot/=lib/v4-periphery/lib/permit2/lib/forge-gas-snapshot/src/",
    "halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
    "hardhat/=lib/uniswap-hooks/lib/v4-core/node_modules/hardhat/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "v4-core/=lib/uniswap-hooks/lib/v4-core/src/",
    "v4-periphery/=lib/v4-periphery/"
  ]
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.