Verified contractExactUNLICENSED
FeeSplitterV2
Address0xf10a6139dcbc65af1fc4dcdc4a3fa5fd9a972e11
- Balance
0 ETH
- Transactions
2
- Compiler
solc 0.8.30
- Same code
224 more contracts
Details
- Compiler
- solc 0.8.30+commit.73712a01
- Language
- solidity
- Optimization
- Yes, 200 runs
- EVM version
- cancun
- Via IR
- yes
- License
- UNLICENSED
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,265,328
- Creation transaction
- 0x8e997bdf9b…3c4159293f
- Main copy (most transactions)
- 0x41b04c1b…a1f1a24d
11 files
- src/v2/FeeSplitterV2.solmain23.42 KB
- lib/openzeppelin-contracts/contracts/interfaces/IERC1363.sol4.45 KB
- lib/openzeppelin-contracts/contracts/interfaces/IERC165.sol192 B
- lib/openzeppelin-contracts/contracts/interfaces/IERC20.sol181 B
- lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol2.78 KB
- lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol9.44 KB
- lib/openzeppelin-contracts/contracts/utils/Address.sol6.03 KB
- lib/openzeppelin-contracts/contracts/utils/Errors.sol896 B
- lib/openzeppelin-contracts/contracts/utils/ReentrancyGuardTransient.sol2.06 KB
- lib/openzeppelin-contracts/contracts/utils/TransientSlot.sol5.07 KB
- lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol870 B
src/v2/FeeSplitterV2.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.30;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {ReentrancyGuardTransient} from "@openzeppelin/contracts/utils/ReentrancyGuardTransient.sol";
/// @title FeeSplitterV2
/// @notice Factory v2's splitter: FeeSplitter with one change. The fee receiver (the `creator` slot,
/// which factory v2 fills with the launch's payee) can be moved by the platform admin only,
/// two-step as before (`adminProposeCreator`, then the nominee's `acceptCreator`). The
/// receiver can no longer nominate a successor itself: owner decision 2026-10-22, so a
/// tokenomics contract or a burn address set at launch stays the receiver unless the
/// platform moves it. The slot keeps the name `creator` so every reader of v1 splitters
/// reads v2 ones. The v1 notes follow.
///
/// @notice Holds one launch's fee rate on one chain, and splits the trading fees it receives
/// between the creator and the platform.
///
/// THE PLATFORM TAKES A FIFTH OF THE FEE, AND NEVER LESS THAN 0.2% OF VOLUME. Whichever is the
/// larger; the creator takes the rest. The two meet at a 1% fee, where a fifth of the fee IS 0.2%
/// of volume. Below it the minimum binds, so the platform's cut of volume stays at 0.2% while the
/// creator's shrinks with the fee -- at the 0.3% floor the platform has two thirds of the fee.
/// Above it the fifth binds, and both grow with the fee:
///
/// fee platform creator
/// 0.3% 0.2% of volume 0.1%
/// 0.5% 0.2% 0.3%
/// 1% 0.2% 0.8%
/// 2% 0.4% 1.6%
/// 5% 1.0% 4.0%
///
/// The fifth is of the WHOLE trading fee, not only of what a venue lets through to this contract:
/// see `venueLpShareBps`.
///
/// DELIBERATELY VENUE-AGNOSTIC. It knows nothing about Uniswap v4, PancakeSwap or Meteora -- it
/// is a balance with two destinations. Whatever claims fees from the locked position sends them
/// here, and `release` pays them out. That keeps one audited contract across every EVM chain
/// instead of one per venue, and means a new venue needs no new splitter.
///
/// THE SPLIT IS IMMUTABLE; THE TWO ADDRESSES ARE NOT. The fee is fixed at construction and the
/// platform's rule is two constants, so the division of every batch is settled for good --
/// no owner, no pause, no upgrade can move it. But each side may redirect its own stream, because
/// a fee stream that runs forever outlives the key that was current at launch: creators rotate to
/// a safe, sell the project, or lose a wallet, and a permanently undeliverable share helps nobody.
///
/// AND THE ADMIN MAY REDIRECT EITHER OF THEM. Said plainly, because it is the one real trust
/// assumption in this contract: the platform admin can point the CREATOR's fee stream at any
/// address, including its own. Nothing here stops that, and a creator should read it as "the
/// platform can take my fees". The split, the rate and the liquidity remain untouchable -- an
/// admin cannot change the fee, cannot unlock the pool, cannot mint, and cannot take what has
/// already been paid out -- but the destination of future fees is the platform's to move.
///
/// It exists because the alternative turned out worse in practice. A creator who loses the key
/// their launch named has a fee stream that accrues forever and can never be collected by anyone,
/// and the only remedy without this is "launch a new token", which abandons the pool, the price
/// history and the holders. The admin address is not stored here: it is read live from the
/// factory that deployed this splitter, so handing that factory's admin to a multisig moves this
/// power with it rather than leaving a stale key behind.
///
/// REDIRECTION IS ALWAYS TWO-STEP, including the admin's. A mistyped address would silently divert
/// that side's income forever, so the new address has to claim itself before it takes effect. That
/// is not a limit on the admin -- it proposes its own address and accepts, two transactions -- it
/// is a limit on typos, which an admin makes as readily as a creator.
///
/// `release` IS PERMISSIONLESS because there is nothing to protect. The only two addresses funds
/// can reach are fixed at construction, so letting anyone trigger a payout costs nothing and
/// means the creator is never waiting on the platform to press a button.
contract FeeSplitterV2 is ReentrancyGuardTransient {
using SafeERC20 for IERC20;
uint256 public constant BPS = 10_000;
/// @notice The least the platform takes: 0.2% of volume, on every launch, forever.
uint16 public constant PLATFORM_FEE_BPS = 20;
/// @notice What the platform takes once that is more: 20% of the whole trading fee.
/// @dev The two are equal at a fee of `PLATFORM_FEE_BPS * BPS / PLATFORM_FEE_SHARE_BPS` = 100
/// bps. Below it `PLATFORM_FEE_BPS` of volume is the larger, above it this share is.
uint16 public constant PLATFORM_FEE_SHARE_BPS = 2_000;
/// @notice The bounds the fee may sit between. Hardcoded, not configurable: a fee anyone
/// could raise without limit is a honeypot.
///
/// The floor is 0.3% rather than 0.2% because of Solana. Meteora's DAMM v2 keeps 20%
/// of every trading fee as protocol revenue, so only 80% reaches the position. At a
/// 0.2% fee that is 0.16% of volume arriving -- less than the 0.2% the platform is
/// owed, which would make the rule unsatisfiable on one of the five chains. 0.3%
/// leaves 0.24% arriving and keeps "the platform gets at least 0.2%" true everywhere.
///
/// The ceiling is 5%. Meteora caps a pool at 99% and Uniswap v4 allows more still,
/// so this is our limit rather than a venue's.
uint16 public constant MIN_FEE_BPS = 30; // 0.3%
uint16 public constant MAX_FEE_BPS = 500; // 5%
/// @notice The most gas a native payout hands its recipient.
/// @dev Enough for a Safe or a smart account to take ether -- a proxy, a delegatecall and an
/// event come to well under a fifth of this -- and no more. Forwarding everything let a
/// creator's contract burn whatever the caller had supplied, on every sweep, so sweeping
/// that launch cost millions of gas for as long as the creator liked. A recipient that
/// needs more than this is deferred to `claimNative`, where it pays for its own gas.
uint256 public constant NATIVE_PAYOUT_GAS = 50_000;
/// @notice The pool's total fee. Fixed at launch and never changes.
/// @dev Immutable because Solana cannot do otherwise: Meteora's DAMM v2 base fee cannot be
/// altered after the pool is created, and the only workaround -- migrating liquidity to
/// a fresh pool -- would orphan the DexScreener pair and reset the price history every
/// time. A fee that moved on four chains and not the fifth would quietly push Solana's
/// arbitrage gap away from the others. Both StonkFun and EmberCurve settled the same
/// way: the creator picks once, at launch.
uint16 public immutable feeBps;
/// @notice The share of the pool's fee that actually reaches this contract, in bps of the
/// fee. 10_000 on Uniswap v4 and PancakeSwap v4, where the whole fee goes to the
/// position. 8_000 on Meteora DAMM v2, which keeps 20% as protocol revenue before
/// the position sees anything.
/// @dev Without this the split is wrong on any venue that skims. The platform is owed a
/// share of *volume*, but what arrives here is a share of the *fee* -- and on Meteora
/// those differ by a fifth. Computing the platform's cut from the arrived amount alone
/// silently underpays it by exactly the venue's cut.
uint16 public immutable venueLpShareBps;
/// @notice The contract that deployed this splitter: a LaunchFactory, whose `admin` may
/// redirect either stream.
/// @dev `msg.sender` rather than a constructor argument, because the factory is the only thing
/// that calls `new FeeSplitter` and an argument could name something else. Immutable, and
/// the admin is NOT copied out of it -- `_admin()` reads it live, so a factory whose admin
/// has been handed to a multisig hands this power to the multisig too, for every splitter
/// it ever deployed, with no migration.
address public immutable factory;
address public creator;
address public platform;
/// @notice The platform address that has been nominated but has not yet claimed its stream.
address public pendingPlatform;
/// @notice The address the platform admin has nominated for the creator's share, if any.
/// @dev A slot of its own. It shared `pendingCreator`, last writer wins -- so whoever held a
/// creator's key could answer every admin proposal with one of their own and the address
/// the admin named could never accept. That is exactly the case the admin's power is
/// for: a creator's key in the wrong hands.
address public adminPendingCreator;
/// @notice Native payouts that could not be delivered, waiting for their owner to collect.
/// @dev Keyed by the address that was owed at the time, not by role, so redirecting a stream
/// later does not hand the old address's money to the new one.
mapping(address => uint256) public unclaimedNative;
/// @notice The sum of `unclaimedNative`. Already owed to someone, so never split again.
uint256 public reservedNative;
event NativeDeferred(address indexed to, uint256 amount);
event NativeClaimed(address indexed owed, address indexed to, uint256 amount);
event Released(address indexed token, uint256 toCreator, uint256 toPlatform);
event CreatorChanged(address indexed from, address indexed to);
event PlatformProposed(address indexed from, address indexed to);
event PlatformChanged(address indexed from, address indexed to);
error ZeroAddress();
error NothingToRelease();
error FeeOutOfRange(uint16 feeBps);
error InvalidVenueShare();
error PlatformCutUnpayable(uint16 feeBps, uint16 venueLpShareBps);
error NotPlatform();
error NotPending();
error NothingToClaim();
error NotEnoughGasForPayout();
error NotAdmin();
error NoAdmin();
event AdminProposedCreator(address indexed admin, address indexed from, address indexed to);
event AdminProposedPlatform(address indexed admin, address indexed from, address indexed to);
/// @param factory_ The factory whose `admin()` governs this splitter. v2 names it rather than
/// taking the deployer: a launch factory has this made by PartsDeployerV2, for size.
constructor(address factory_, address creator_, address platform_, uint16 feeBps_, uint16 venueLpShareBps_) {
if (factory_ == address(0) || creator_ == address(0) || platform_ == address(0)) revert ZeroAddress();
if (venueLpShareBps_ == 0 || venueLpShareBps_ > BPS) revert InvalidVenueShare();
_checkFee(feeBps_, venueLpShareBps_);
creator = creator_;
platform = platform_;
venueLpShareBps = venueLpShareBps_;
feeBps = feeBps_;
factory = factory_;
}
/// @notice The address currently allowed to redirect either stream: the deploying factory's
/// admin, read at the moment it is used.
/// @dev Reverts with NoAdmin when `factory` has no `admin()` -- a splitter deployed directly
/// in a test, or by something that is not a factory. That is the correct outcome: there
/// is no admin, so there is no admin power, and the creator and platform paths below are
/// unaffected.
function admin() public view returns (address a) {
(bool ok, bytes memory out) = factory.staticcall(abi.encodeWithSignature("admin()"));
if (!ok || out.length != 32) revert NoAdmin();
a = abi.decode(out, (address));
if (a == address(0)) revert NoAdmin();
}
function _requireAdmin() internal view {
if (msg.sender != admin()) revert NotAdmin();
}
/// @dev Bounds, plus the thing the bounds exist for: after the venue takes its cut, what
/// arrives must still cover whichever of the platform's two figures applies. Its 0.2% of
/// volume needs `fee * lpShare >= PLATFORM_FEE_BPS * BPS`: on a venue skimming more than
/// Meteora the 0.3% floor would stop being enough. Its fifth of the WHOLE fee needs the
/// venue to pass on at least a fifth, `lpShare >= PLATFORM_FEE_SHARE_BPS`. Since the
/// fee can never be corrected afterwards this has to reject at construction rather than
/// underpay for the life of the pool.
function _checkFee(uint16 fee, uint16 lpShare) internal pure {
if (fee < MIN_FEE_BPS || fee > MAX_FEE_BPS) revert FeeOutOfRange(fee);
if (uint256(fee) * lpShare < uint256(PLATFORM_FEE_BPS) * BPS || lpShare < PLATFORM_FEE_SHARE_BPS) {
revert PlatformCutUnpayable(fee, lpShare);
}
}
// ------------------------------------------------------------ redirection
/// @notice Claim the fee receiver's stream, as the address the platform admin nominated. There
/// is no other way to change the receiver.
function acceptCreator() external {
if (msg.sender != adminPendingCreator) revert NotPending();
emit CreatorChanged(creator, msg.sender);
creator = msg.sender;
adminPendingCreator = address(0);
}
/// @notice Nominate a new address for the platform's share. It must accept before it applies.
function proposePlatform(address to) external {
if (msg.sender != platform) revert NotPlatform();
if (to == address(0)) revert ZeroAddress();
pendingPlatform = to;
emit PlatformProposed(platform, to);
}
function acceptPlatform() external {
if (msg.sender != pendingPlatform) revert NotPending();
emit PlatformChanged(platform, msg.sender);
platform = msg.sender;
pendingPlatform = address(0);
}
/// @notice Nominate a new address for the CREATOR's share, as the platform admin.
///
/// @dev The trust assumption named at the top of this file, and the reason it is here: a
/// creator who loses the key their launch named otherwise has a fee stream that nobody
/// can ever collect, on a pool whose liquidity is locked for good. Without this the only
/// remedy is relaunching the token, which abandons the pool, its price history and its
/// holders.
///
/// It has a pending slot of its own, so the creator's key cannot overwrite what the
/// admin named and the admin does not overwrite what the creator named: either nominee
/// may accept, and accepting clears both. Both are logged with their own event, so which
/// of the two moved a stream is always readable from the chain rather than inferred.
///
/// It emits a distinct event rather than reusing CreatorProposed, because "the creator
/// moved their own fees" and "the platform moved the creator's fees" are different facts
/// and an indexer should not have to guess which happened.
function adminProposeCreator(address to) external {
_requireAdmin();
if (to == address(0)) revert ZeroAddress();
adminPendingCreator = to;
emit AdminProposedCreator(msg.sender, creator, to);
}
/// @notice Nominate a new address for the PLATFORM's share, as the platform admin.
/// @dev Adds no trust: the admin and the platform are the same party. It exists so a platform
/// payout address can be rotated from the admin key when the platform address itself is a
/// cold wallet that is inconvenient to transact from.
function adminProposePlatform(address to) external {
_requireAdmin();
if (to == address(0)) revert ZeroAddress();
pendingPlatform = to;
emit AdminProposedPlatform(msg.sender, platform, to);
}
/// @notice Pay out the full balance of `token`: to the platform a fifth of the fee it came
/// from or 0.2% of the volume it came from, whichever is more; the rest to the creator.
/// @dev The platform's share is rounded down and the creator takes the remainder, so the
/// rounding dust goes to the creator rather than being stranded here. On any realistic
/// fee that is sub-wei in significance; what matters is that the two shares always sum
/// to the whole balance and nothing accumulates.
function release(address token) external {
uint256 amount = IERC20(token).balanceOf(address(this));
if (amount == 0) revert NothingToRelease();
uint256 toPlatform = _platformShare(amount);
uint256 toCreator = amount - toPlatform;
// The balance is read at entry and both shares are fixed before either transfer: a token
// with transfer hooks that re-enters finds a smaller balance and simply splits less,
// never more, and never the same wei twice. (The recipients are read from storage at each
// transfer; neither party can change the other's, and a change of one's own is two-step.)
if (toCreator > 0) IERC20(token).safeTransfer(creator, toCreator);
if (toPlatform > 0) IERC20(token).safeTransfer(platform, toPlatform);
emit Released(token, toCreator, toPlatform);
}
/// @notice The same, for fees paid in the chain's native asset.
///
/// @dev A payout that fails is set aside for its owner rather than reverting the call. Both
/// shares used to be pushed in one transaction, so a creator whose address refused ether
/// -- by accident or on purpose -- held the platform's share hostage along with their
/// own, for as long as they liked. Now each side's money is only ever that side's problem.
///
/// `nonReentrant` is what makes that safe. A payout that fails no longer reverts, so a
/// recipient re-entering here mid-payment would find the other side's share still in the
/// balance and split it again in its own favour.
function releaseNative() external nonReentrant {
uint256 amount = address(this).balance - reservedNative;
if (amount == 0) revert NothingToRelease();
uint256 toPlatform = _platformShare(amount);
uint256 toCreator = amount - toPlatform;
if (toCreator > 0) _payNative(creator, toCreator);
if (toPlatform > 0) _payNative(platform, toPlatform);
emit Released(address(0), toCreator, toPlatform);
}
/// @notice Collect native fees that could not be delivered to the caller, to any address.
function claimNative(address payable to) external nonReentrant {
if (to == address(0)) revert ZeroAddress();
uint256 amount = unclaimedNative[msg.sender];
if (amount == 0) revert NothingToClaim();
unclaimedNative[msg.sender] = 0;
reservedNative -= amount;
Address.sendValue(to, amount);
emit NativeClaimed(msg.sender, to, amount);
}
/// @dev A plain call rather than `transfer`: the 2300-gas stipend breaks recipients that are
/// safes or smart accounts, which a creator's address very often is. Capped all the
/// same -- see `NATIVE_PAYOUT_GAS`.
///
/// The check before the call is the other half of the cap. A call can pass on at most
/// 63/64 of the gas left, so without it whoever triggers the release could supply just
/// too little, have a perfectly good recipient run out, and push its share into
/// `unclaimedNative` on purpose. The margin covers what the call itself costs to make.
function _payNative(address to, uint256 amount) internal {
if (gasleft() < (NATIVE_PAYOUT_GAS * 64) / 63 + 40_000) revert NotEnoughGasForPayout();
(bool ok,) = to.call{value: amount, gas: NATIVE_PAYOUT_GAS}("");
if (ok) return;
unclaimedNative[to] += amount;
reservedNative += amount;
emit NativeDeferred(to, amount);
}
/// @notice The platform's share of a fee batch: the larger of 0.2% of the volume it came
/// from and 20% of the whole fee charged on that volume.
/// @dev Both are worked back from what arrived rather than read off it. The pool charged
/// `feeBps` of volume and let `venueLpShareBps` of that through, so
/// `amount = volume * feeBps * venueLpShareBps` (each over `BPS`). Then
///
/// the minimum: volume * PLATFORM_FEE_BPS = amount * PLATFORM_FEE_BPS * BPS / (feeBps * venueLpShareBps)
/// the share: volume * feeBps * PLATFORM_FEE_SHARE_BPS = amount * PLATFORM_FEE_SHARE_BPS / venueLpShareBps
///
/// The share is of the WHOLE fee, the venue's own cut included -- which is why it divides
/// by `venueLpShareBps` and not by `BPS`. Where the venue keeps nothing (Uniswap v4:
/// 10,000) it is exactly a fifth of what arrived; where a venue keeps a fifth of the fee
/// (8,000) it is a quarter of what arrived, which is the same fifth of the whole.
///
/// Each is rounded down, and it is one or the other for every batch a splitter ever
/// sees, because which is larger depends only on `feeBps` -- at exactly 100 bps they are
/// the same number.
///
/// Clamped to the whole batch: `_checkFee` makes the shortfall impossible at
/// construction, and the fee never changes afterwards, but a clamp is cheaper than
/// trusting an invariant for the life of a pool nobody can fix.
function _platformShare(uint256 amount) internal view returns (uint256) {
uint256 minimum = (amount * PLATFORM_FEE_BPS * BPS) / (uint256(feeBps) * venueLpShareBps);
uint256 share = (amount * PLATFORM_FEE_SHARE_BPS) / venueLpShareBps;
uint256 owed = share > minimum ? share : minimum;
return owed > amount ? amount : owed;
}
/// @notice How a release of the current balance would divide.
function pending(address token) external view returns (uint256 toCreator, uint256 toPlatform) {
uint256 amount = IERC20(token).balanceOf(address(this));
toPlatform = _platformShare(amount);
toCreator = amount - toPlatform;
}
/// @notice How a `releaseNative` of the current balance would divide.
/// @dev Excludes `reservedNative`, exactly as `releaseNative` does: that is already owed to
/// whoever could not be paid and is never split again. Both zero means there is nothing
/// to release and `releaseNative` would revert.
function pendingNative() external view returns (uint256 toCreator, uint256 toPlatform) {
uint256 amount = address(this).balance - reservedNative;
toPlatform = _platformShare(amount);
toCreator = amount - toPlatform;
}
receive() external payable {}
}
lib/openzeppelin-contracts/contracts/interfaces/IERC1363.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol)
pragma solidity ^0.8.20;
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.0.0) (interfaces/IERC165.sol)
pragma solidity ^0.8.20;
import {IERC165} from "../utils/introspection/IERC165.sol";
lib/openzeppelin-contracts/contracts/interfaces/IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../token/ERC20/IERC20.sol";
lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.20;
/**
* @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/utils/SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";
import {Address} from "../../../utils/Address.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 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/Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Address.sol)
pragma solidity ^0.8.20;
import {Errors} from "./Errors.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);
}
(bool success, ) = recipient.call{value: amount}("");
if (!success) {
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, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @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, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @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, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata);
}
/**
* @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.
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata
) internal view returns (bytes memory) {
if (!success) {
_revert(returndata);
} else {
// 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 (returndata.length == 0 && target.code.length == 0) {
revert AddressEmptyCode(target);
}
return returndata;
}
}
/**
* @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) {
_revert(returndata);
} else {
return returndata;
}
}
/**
* @dev Reverts with returndata if present. Otherwise reverts with {Errors.FailedCall}.
*/
function _revert(bytes memory returndata) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly ("memory-safe") {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert Errors.FailedCall();
}
}
}
lib/openzeppelin-contracts/contracts/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);
}
lib/openzeppelin-contracts/contracts/utils/ReentrancyGuardTransient.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuardTransient.sol)
pragma solidity ^0.8.24;
import {TransientSlot} from "./TransientSlot.sol";
/**
* @dev Variant of {ReentrancyGuard} that uses transient storage.
*
* NOTE: This variant only works on networks where EIP-1153 is available.
*
* _Available since v5.1._
*/
abstract contract ReentrancyGuardTransient {
using TransientSlot for *;
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant REENTRANCY_GUARD_STORAGE =
0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00;
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
/**
* @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 (_reentrancyGuardEntered()) {
revert ReentrancyGuardReentrantCall();
}
// Any calls to nonReentrant after this point will fail
REENTRANCY_GUARD_STORAGE.asBoolean().tstore(true);
}
function _nonReentrantAfter() private {
REENTRANCY_GUARD_STORAGE.asBoolean().tstore(false);
}
/**
* @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 REENTRANCY_GUARD_STORAGE.asBoolean().tload();
}
}
lib/openzeppelin-contracts/contracts/utils/TransientSlot.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/TransientSlot.sol)
// This file was procedurally generated from scripts/generate/templates/TransientSlot.js.
pragma solidity ^0.8.24;
/**
* @dev Library for reading and writing value-types to specific transient storage slots.
*
* Transient slots are often used to store temporary values that are removed after the current transaction.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* * Example reading and writing values using transient storage:
* ```solidity
* contract Lock {
* using TransientSlot for *;
*
* // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.
* bytes32 internal constant _LOCK_SLOT = 0xf4678858b2b588224636b8522b729e7722d32fc491da849ed75b3fdf3c84f542;
*
* modifier locked() {
* require(!_LOCK_SLOT.asBoolean().tload());
*
* _LOCK_SLOT.asBoolean().tstore(true);
* _;
* _LOCK_SLOT.asBoolean().tstore(false);
* }
* }
* ```
*
* TIP: Consider using this library along with {SlotDerivation}.
*/
library TransientSlot {
/**
* @dev UDVT that represent a slot holding a address.
*/
type AddressSlot is bytes32;
/**
* @dev Cast an arbitrary slot to a AddressSlot.
*/
function asAddress(bytes32 slot) internal pure returns (AddressSlot) {
return AddressSlot.wrap(slot);
}
/**
* @dev UDVT that represent a slot holding a bool.
*/
type BooleanSlot is bytes32;
/**
* @dev Cast an arbitrary slot to a BooleanSlot.
*/
function asBoolean(bytes32 slot) internal pure returns (BooleanSlot) {
return BooleanSlot.wrap(slot);
}
/**
* @dev UDVT that represent a slot holding a bytes32.
*/
type Bytes32Slot is bytes32;
/**
* @dev Cast an arbitrary slot to a Bytes32Slot.
*/
function asBytes32(bytes32 slot) internal pure returns (Bytes32Slot) {
return Bytes32Slot.wrap(slot);
}
/**
* @dev UDVT that represent a slot holding a uint256.
*/
type Uint256Slot is bytes32;
/**
* @dev Cast an arbitrary slot to a Uint256Slot.
*/
function asUint256(bytes32 slot) internal pure returns (Uint256Slot) {
return Uint256Slot.wrap(slot);
}
/**
* @dev UDVT that represent a slot holding a int256.
*/
type Int256Slot is bytes32;
/**
* @dev Cast an arbitrary slot to a Int256Slot.
*/
function asInt256(bytes32 slot) internal pure returns (Int256Slot) {
return Int256Slot.wrap(slot);
}
/**
* @dev Load the value held at location `slot` in transient storage.
*/
function tload(AddressSlot slot) internal view returns (address value) {
assembly ("memory-safe") {
value := tload(slot)
}
}
/**
* @dev Store `value` at location `slot` in transient storage.
*/
function tstore(AddressSlot slot, address value) internal {
assembly ("memory-safe") {
tstore(slot, value)
}
}
/**
* @dev Load the value held at location `slot` in transient storage.
*/
function tload(BooleanSlot slot) internal view returns (bool value) {
assembly ("memory-safe") {
value := tload(slot)
}
}
/**
* @dev Store `value` at location `slot` in transient storage.
*/
function tstore(BooleanSlot slot, bool value) internal {
assembly ("memory-safe") {
tstore(slot, value)
}
}
/**
* @dev Load the value held at location `slot` in transient storage.
*/
function tload(Bytes32Slot slot) internal view returns (bytes32 value) {
assembly ("memory-safe") {
value := tload(slot)
}
}
/**
* @dev Store `value` at location `slot` in transient storage.
*/
function tstore(Bytes32Slot slot, bytes32 value) internal {
assembly ("memory-safe") {
tstore(slot, value)
}
}
/**
* @dev Load the value held at location `slot` in transient storage.
*/
function tload(Uint256Slot slot) internal view returns (uint256 value) {
assembly ("memory-safe") {
value := tload(slot)
}
}
/**
* @dev Store `value` at location `slot` in transient storage.
*/
function tstore(Uint256Slot slot, uint256 value) internal {
assembly ("memory-safe") {
tstore(slot, value)
}
}
/**
* @dev Load the value held at location `slot` in transient storage.
*/
function tload(Int256Slot slot) internal view returns (int256 value) {
assembly ("memory-safe") {
value := tload(slot)
}
}
/**
* @dev Store `value` at location `slot` in transient storage.
*/
function tstore(Int256Slot slot, int256 value) internal {
assembly ("memory-safe") {
tstore(slot, value)
}
}
}
lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)
pragma solidity ^0.8.20;
/**
* @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);
}
Compiler settingsShow
{
"viaIR": true,
"metadata": {
"bytecodeHash": "ipfs"
},
"libraries": {},
"optimizer": {
"runs": 200,
"enabled": true
},
"evmVersion": "cancun",
"remappings": [
"@layerzerolabs/lz-evm-protocol-v2/=lib/layerzero/protocol-v2/",
"@layerzerolabs/oapp-evm/=lib/layerzero/oapp-evm/",
"@layerzerolabs/oft-evm/=lib/layerzero/oft-evm/",
"@openzeppelin/=lib/openzeppelin-contracts/",
"@uniswap/v4-core/=lib/uniswap-v4-core/",
"ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
"erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/",
"halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"layerzero/=lib/layerzero/",
"openzeppelin-contracts/=lib/openzeppelin-contracts/",
"solmate/=lib/solmate/",
"uniswap-v4-core/=lib/uniswap-v4-core/src/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.