Verified contractExactMIT
LiquidityLocker
Address0x78ee0b1b9264afe0903c02fe6c6fda482694de24
- Balance
0 ETH
- Transactions
7
- Compiler
solc 0.8.24
- Same code
Only this contract
Details
- Compiler
- solc 0.8.24+commit.e11b9ed9
- Language
- solidity
- Optimization
- Yes, 200 runs
- EVM version
- cancun
- Via IR
- yes
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,173,065
- Creation transaction
- 0x4fb99530e7…5d8cded3cd
19 files
- src/LiquidityLocker.solmain16.43 KB
- lib/openzeppelin-contracts/contracts/access/Ownable.sol3.1 KB
- lib/openzeppelin-contracts/contracts/interfaces/IERC1363.sol4.45 KB
- lib/openzeppelin-contracts/contracts/interfaces/IERC165.sol193 B
- lib/openzeppelin-contracts/contracts/interfaces/IERC20.sol182 B
- lib/openzeppelin-contracts/contracts/interfaces/IERC20Metadata.sol216 B
- lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol2.78 KB
- lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol684 B
- lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol13.96 KB
- lib/openzeppelin-contracts/contracts/token/ERC721/IERC721.sol4.93 KB
- lib/openzeppelin-contracts/contracts/token/ERC721/IERC721Receiver.sol997 B
- lib/openzeppelin-contracts/contracts/utils/Context.sol963 B
- lib/openzeppelin-contracts/contracts/utils/ReentrancyGuard.sol4.77 KB
- lib/openzeppelin-contracts/contracts/utils/StorageSlot.sol4.18 KB
- lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol871 B
- src/FeeSplitter.sol26.78 KB
- src/LaunchConfig.sol14.3 KB
- src/interfaces/IAmmAdapter.sol4.21 KB
- src/interfaces/IUniswapV3Minimal.sol5.75 KB
src/LiquidityLocker.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IAmmAdapter} from "./interfaces/IAmmAdapter.sol";
import {FeeSplitter} from "./FeeSplitter.sol";
/**
* Holds LP position NFTs permanently. Spec §4.1.1, decided 2026-07-31 as the
* "immutable locker" option over burning the position: this contract has NO
* withdraw, unlock, transfer, or owner-privileged function of any kind, is
* not time-locked, and is not upgradeable — nothing here can ever move the
* underlying liquidity out. `collectFees` is the *only* thing anyone can do
* with a locked position, and it's permissionless (callable by anyone, or a
* keeper bot) precisely so the platform's own infrastructure staying up is
* never a dependency for fee collection. `increaseLiquidity` (spec §4.3,
* added for AutoLiquidityForge) is the only other thing anyone can do with a
* locked position — it only ever adds, pulling both sides from the caller,
* so it can't violate the "no withdraw, ever" guarantee above.
*
* Multi-venue launches (Uniswap V3 or SushiSwap V3, admin-registered on
* LaunchConfig): this contract holds positions from either venue side by
* side, keyed per-pool to whichever IAmmAdapter minted it (see `adapterOf`).
* All position operations route through that adapter instead of a single
* global `positionManager` — `registerPosition` grants the adapter
* per-tokenId ERC-721 operator approval, scoped to exactly that position, so
* `collectFees` can call through to the venue's own `positionManager.collect`
* (see IAmmAdapter's docstring on why this approval is safe: no adapter
* exposes any decrease-liquidity or transfer function).
*
* Each pool records its own quote asset at registration (`quoteOf`). This
* file used to say the opposite — that every pool pairs against the immutable
* `quoteToken`, so ordering was derivable from the launched token alone and
* there was "no need to store it separately per position". That was true until
* a second quote asset was registered, at which point a USDG pool reported its
* pair as WETH and every collectFees reverted, permanently. The assumption is
* now recorded rather than inferred.
*
* `feeSplitter` and `tokenFactory` are wired in once, post-deploy (see
* FeeSplitter's docstring for why the three contracts can't all know each
* other's addresses at construction time).
*/
/**
* A note on the guard, since its absence was defensible and its presence is
* better.
*
* Neither function below could be exploited by re-entering it. Both take their
* amounts from what the adapter reports rather than from reading a balance, so
* being interrupted does not change the arithmetic, and no asset in play today
* calls back on transfer.
*
* That is an argument, and an argument has to be re-run by whoever adds the
* next quote asset. The tokenized equities are ERC-8056 and the list of what
* pools may pair against is meant to grow. A lock costs one storage slot and
* removes the need to think about it again.
*/
contract LiquidityLocker is Ownable, IERC721Receiver, ReentrancyGuard {
using SafeERC20 for IERC20;
address public immutable quoteToken;
FeeSplitter public feeSplitter;
address public tokenFactory;
/**
* Every position this contract has ever taken custody of, by venue.
*
* The guard that was missing, and it is the difference between "no function
* here withdraws" and "the liquidity cannot leave".
*
* `positionOf` is keyed by pool handle, so it only ever stopped the same
* *pool* being registered twice. Nothing stopped the same *position* being
* registered under a second handle -- and registration is what grants an
* adapter ERC-721 approval over the position. The factory takes its adapter
* from LaunchConfig, and the pool handle and tokenId from the adapter
* itself, so an owner who replaced the adapter could have any subsequent
* launch re-register an already-locked position under a fresh handle and
* hand the new adapter approval over it. One transfer later the LP was
* gone.
*
* Reported by FOMO while reviewing this platform for a liquidity-lock
* badge: they read it out of the verified source and had not reproduced it.
* LockerCustody.t.sol reproduces it against this guard removed, and shows
* it refused with it in place.
*
* Keyed by position manager as well as id, because a tokenId is only unique
* within its own venue.
*/
mapping(address positionManager => mapping(uint256 tokenId => bool)) public positionLocked;
mapping(address pool => uint256 tokenId) public positionOf;
mapping(address pool => address launchedToken) public launchedTokenOf;
mapping(address pool => IAmmAdapter adapter) public adapterOf;
/**
* What this pool's other side actually is.
*
* The immutable `quoteToken` above used to answer this for every pool, and
* the contract said so: "no need to store it separately per position". That
* held only while WETH was the sole quote asset. The moment a second one
* was registered it became a silent, unrecoverable bug — a USDG pool would
* report its pair as WETH, FeeSplitter would try to move WETH it never
* received, and every collectFees would revert. Not once: forever, with no
* admin path to the fees.
*
* Zero means a position registered before this existed, which falls back to
* `quoteToken`. That keeps already-locked positions collectable rather than
* stranding them to fix a bug they never had.
*/
mapping(address pool => address quote) public quoteOf;
/**
* What the caller of `collectFees` keeps, in basis points of the quote leg.
*
* Collection is permissionless and always will be, but somebody has to pay
* the gas, and before this the platform did — out of pocket, on every sweep
* of every pool, forever. This pays the caller back from the fees being
* collected, in the same transaction, so a keeper funds itself and the
* platform sponsors nothing.
*
* Taken from the quote leg only. That is deliberate: the quote leg is WETH
* or a stablecoin, so a keeper is reimbursed in something it can actually
* spend on gas. Paid in the launched token it would accumulate memecoins it
* had to sell before it could afford the next sweep.
*
* Zero by default — the platform can still choose to sponsor.
*/
uint256 public keeperFeeBps;
/** Guards against an owner setting a fee that eats a meaningful share of
* what creators earn. 5% is already generous against a sub-cent gas cost. */
uint256 public constant MAX_KEEPER_FEE_BPS = 500;
event FeeSplitterSet(address indexed feeSplitter);
event TokenFactorySet(address indexed tokenFactory);
uint256 private constant BPS_DENOMINATOR = 10_000;
event PositionRegistered(address indexed pool, address indexed launchedToken, uint256 tokenId);
event FeesCollected(address indexed pool, uint256 amount0, uint256 amount1);
event KeeperReimbursed(address indexed pool, address indexed keeper, address quote, uint256 amount);
event KeeperFeeUpdated(uint256 bps);
event LiquidityIncreased(address indexed pool, uint256 amount0, uint256 amount1);
constructor(address quoteToken_, address owner_) Ownable(owner_) {
require(quoteToken_ != address(0), "quoteToken=0");
quoteToken = quoteToken_;
}
/// @notice One-time wiring calls, run immediately after FeeSplitter/TokenFactory are deployed (see script/DeployQuickLaunch.s.sol).
function setFeeSplitter(FeeSplitter feeSplitter_) external onlyOwner {
require(address(feeSplitter) == address(0), "already set");
require(address(feeSplitter_) != address(0), "feeSplitter=0");
feeSplitter = feeSplitter_;
emit FeeSplitterSet(address(feeSplitter_));
}
function setTokenFactory(address tokenFactory_) external onlyOwner {
require(tokenFactory == address(0), "already set");
require(tokenFactory_ != address(0), "factory=0");
tokenFactory = tokenFactory_;
emit TokenFactorySet(tokenFactory_);
}
/// @notice Called by TokenFactory right after minting the initial LP position through
/// `adapter` with this contract as recipient, so `collectFees`/`increaseLiquidity` know
/// which venue and which position belong to which pool.
function registerPosition(
address pool,
address launchedToken,
uint256 tokenId,
IAmmAdapter adapter,
address quote
) external {
require(msg.sender == tokenFactory, "not authorized");
require(positionOf[pool] == 0, "pool already registered");
require(quote != address(0), "quote=0");
// Recorded now, while the factory still knows it. Deriving it later
// from the launched token's address alone is what broke USDG pairs.
quoteOf[pool] = quote;
require(address(adapter) != address(0), "adapter=0");
address venuePositionManager = adapter.positionManager();
require(IERC721(venuePositionManager).ownerOf(tokenId) == address(this), "not held");
// Once ever, per position. See `positionLocked`: without this, a
// replaced adapter could be handed approval over liquidity that was
// already locked, which is the one thing this contract exists to
// prevent.
require(!positionLocked[venuePositionManager][tokenId], "position already locked");
positionLocked[venuePositionManager][tokenId] = true;
positionOf[pool] = tokenId;
launchedTokenOf[pool] = launchedToken;
adapterOf[pool] = adapter;
// Per-tokenId operator approval, scoped to exactly this position — not a blanket
// setApprovalForAll across every position this contract holds.
IERC721(venuePositionManager).approve(address(adapter), tokenId);
emit PositionRegistered(pool, launchedToken, tokenId);
}
/// @notice Permissionless — anyone, or a keeper bot, can trigger fee collection at any time (spec §4.1.1).
function collectFees(address pool) external nonReentrant {
uint256 tokenId = positionOf[pool];
require(tokenId != 0, "unregistered pool");
_collect(pool, tokenId, true);
}
function _collect(address pool, uint256 tokenId, bool reimburseKeeper) private {
address launchedToken = launchedTokenOf[pool];
IAmmAdapter adapter = adapterOf[pool];
// This pool's own quote asset, not the chain's default one. Positions
// registered before quoteOf existed fall back, so they stay collectable.
address quote = quoteOf[pool];
if (quote == address(0)) quote = quoteToken;
// Collected here rather than straight to FeeSplitter so the caller can
// be reimbursed before the split. The alternative -- paying the keeper
// out of FeeSplitter afterwards -- would mean it needed to know who
// sent a transaction it did not receive.
(uint256 amount0, uint256 amount1) = adapter.collectFees(tokenId, address(this));
(address token0, address token1) =
launchedToken < quote ? (launchedToken, quote) : (quote, launchedToken);
uint256 keeperPaid = 0;
if (reimburseKeeper && keeperFeeBps > 0) {
// The quote leg is whichever side is not the launched token.
bool quoteIsToken0 = token0 == quote;
uint256 quoteAmount = quoteIsToken0 ? amount0 : amount1;
keeperPaid = (quoteAmount * keeperFeeBps) / BPS_DENOMINATOR;
if (keeperPaid > 0) {
if (quoteIsToken0) amount0 -= keeperPaid;
else amount1 -= keeperPaid;
IERC20(quote).safeTransfer(msg.sender, keeperPaid);
}
}
if (amount0 > 0 || amount1 > 0) {
// Forwarded explicitly now that this contract is the recipient.
if (amount0 > 0) IERC20(token0).safeTransfer(address(feeSplitter), amount0);
if (amount1 > 0) IERC20(token1).safeTransfer(address(feeSplitter), amount1);
feeSplitter.distribute(launchedToken, token0, amount0, token1, amount1, quote, adapter);
}
emit FeesCollected(pool, amount0, amount1);
if (keeperPaid > 0) emit KeeperReimbursed(pool, msg.sender, quote, keeperPaid);
}
/// @notice Sets what a caller of `collectFees` keeps, in basis points of the
/// quote leg. Capped so this can never quietly become a large tax on
/// creators' fees.
function setKeeperFeeBps(uint256 bps) external onlyOwner {
require(bps <= MAX_KEEPER_FEE_BPS, "keeper fee too high");
keeperFeeBps = bps;
emit KeeperFeeUpdated(bps);
}
/// @notice Permissionless top-up of a locked position — pulls `amountA`/`amountB` of
/// `tokenA`/`tokenB` from the caller and adds them to that pool's existing locked LP
/// (spec §4.3's AutoLiquidityForge is the intended caller, but anyone can top up any
/// locked position). Additive only: no way to move liquidity back out through this.
function increaseLiquidity(
address pool,
address tokenA,
uint256 amountA,
address tokenB,
uint256 amountB
) external nonReentrant {
uint256 tokenId = positionOf[pool];
require(tokenId != 0, "unregistered pool");
require(amountA > 0 || amountB > 0, "nothing to add");
IAmmAdapter adapter = adapterOf[pool];
// A V4 INCREASE nets the position's accrued fees into the top-up and
// the adapter refunds them to the caller as unspent principal.
_collect(pool, tokenId, false);
// The pair is the pool's, not the caller's. Taking token addresses
// from the caller hands an outside contract a call from inside this
// one and lets the adapter be pointed at balances that are not the
// pool's — the same shape as taking a payout address from the caller.
{
address launched = launchedTokenOf[pool];
address quote = quoteOf[pool];
if (quote == address(0)) quote = quoteToken;
require(
(tokenA == launched && tokenB == quote) || (tokenA == quote && tokenB == launched),
"not this pool's pair"
);
}
if (amountA > 0) IERC20(tokenA).safeTransferFrom(msg.sender, address(this), amountA);
if (amountB > 0) IERC20(tokenB).safeTransferFrom(msg.sender, address(this), amountB);
(address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
(uint256 amount0Desired, uint256 amount1Desired) = tokenA < tokenB ? (amountA, amountB) : (amountB, amountA);
if (amount0Desired > 0) IERC20(token0).safeTransfer(address(adapter), amount0Desired);
if (amount1Desired > 0) IERC20(token1).safeTransfer(address(adapter), amount1Desired);
(uint256 amount0, uint256 amount1) = adapter.increaseLiquidity(
tokenId,
token0,
token1,
amount0Desired,
amount1Desired
);
// The adapter already refunds any unconsumed amount to its own caller (this
// contract); forward that dust on to whoever actually called us.
if (amount0 < amount0Desired) IERC20(token0).safeTransfer(msg.sender, amount0Desired - amount0);
if (amount1 < amount1Desired) IERC20(token1).safeTransfer(msg.sender, amount1Desired - amount1);
emit LiquidityIncreased(pool, amount0, amount1);
}
function onERC721Received(
address /* operator */,
address /* from */,
uint256 /* tokenId */,
bytes calldata /* data */
) external pure override returns (bytes4) {
return IERC721Receiver.onERC721Received.selector;
}
}
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/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/interfaces/IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC20Metadata.sol)
pragma solidity >=0.6.2;
import {IERC20Metadata} from "../token/ERC20/extensions/IERC20Metadata.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/utils/SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.7.0) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.20;
import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";
import {IERC20Metadata} from "../../../interfaces/IERC20Metadata.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 {
if (!_safeTransfer(token, to, value, true)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @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 {
if (!_safeTransferFrom(token, from, to, value, true)) {
revert SafeERC20FailedOperation(address(token));
}
}
/**
* @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 _safeTransfer(token, to, value, false);
}
/**
* @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 _safeTransferFrom(token, from, to, value, false);
}
/**
* @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 {
if (!_safeApprove(token, spender, value, false)) {
if (!_safeApprove(token, spender, 0, true)) revert SafeERC20FailedOperation(address(token));
if (!_safeApprove(token, spender, value, true)) revert SafeERC20FailedOperation(address(token));
}
}
/**
* @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 relies 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 relies 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}.
* Oppositely, 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 Attempts to fetch the token decimals. A return value of false indicates that the attempt failed in some way.
function tryGetDecimals(IERC20 token) internal view returns (bool success, uint8 decimals) {
bytes4 selector = IERC20Metadata.decimals.selector;
assembly ("memory-safe") {
mstore(0x00, selector)
success := staticcall(gas(), token, 0x00, 4, 0x00, 0x20)
success := and(and(success, gt(returndatasize(), 0x1f)), lt(mload(0x00), 0x100))
decimals := mul(success, mload(0x00))
}
}
/**
* @dev Imitates a Solidity `token.transfer(to, value)` call, 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 to The recipient of the tokens
* @param value The amount of token to transfer
* @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean.
*/
function _safeTransfer(IERC20 token, address to, uint256 value, bool bubble) private returns (bool success) {
bytes4 selector = IERC20.transfer.selector;
assembly ("memory-safe") {
let fmp := mload(0x40)
mstore(0x00, selector)
mstore(0x04, and(to, shr(96, not(0))))
mstore(0x24, value)
success := call(gas(), token, 0, 0x00, 0x44, 0x00, 0x20)
// if call success and return is true, all is good.
// otherwise (not success or return is not true), we need to perform further checks
if iszero(and(success, eq(mload(0x00), 1))) {
// if the call was a failure and bubble is enabled, bubble the error
if and(iszero(success), bubble) {
returndatacopy(fmp, 0x00, returndatasize())
revert(fmp, returndatasize())
}
// if the return value is not true, then the call is only successful if:
// - the token address has code
// - the returndata is empty
success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))
}
mstore(0x40, fmp)
}
}
/**
* @dev Imitates a Solidity `token.transferFrom(from, to, value)` call, 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 from The sender of the tokens
* @param to The recipient of the tokens
* @param value The amount of token to transfer
* @param bubble Behavior switch if the transfer call reverts: bubble the revert reason or return a false boolean.
*/
function _safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value,
bool bubble
) private returns (bool success) {
bytes4 selector = IERC20.transferFrom.selector;
assembly ("memory-safe") {
let fmp := mload(0x40)
mstore(0x00, selector)
mstore(0x04, and(from, shr(96, not(0))))
mstore(0x24, and(to, shr(96, not(0))))
mstore(0x44, value)
success := call(gas(), token, 0, 0x00, 0x64, 0x00, 0x20)
// if call success and return is true, all is good.
// otherwise (not success or return is not true), we need to perform further checks
if iszero(and(success, eq(mload(0x00), 1))) {
// if the call was a failure and bubble is enabled, bubble the error
if and(iszero(success), bubble) {
returndatacopy(fmp, 0x00, returndatasize())
revert(fmp, returndatasize())
}
// if the return value is not true, then the call is only successful if:
// - the token address has code
// - the returndata is empty
success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))
}
mstore(0x40, fmp)
mstore(0x60, 0)
}
}
/**
* @dev Imitates a Solidity `token.approve(spender, value)` call, 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 spender The spender of the tokens
* @param value The amount of token to approve
* @param bubble Behavior switch if the approve call reverts: bubble the revert reason or return a false boolean.
*/
function _safeApprove(IERC20 token, address spender, uint256 value, bool bubble) private returns (bool success) {
bytes4 selector = IERC20.approve.selector;
assembly ("memory-safe") {
let fmp := mload(0x40)
mstore(0x00, selector)
mstore(0x04, and(spender, shr(96, not(0))))
mstore(0x24, value)
success := call(gas(), token, 0, 0x00, 0x44, 0x00, 0x20)
// if call success and return is true, all is good.
// otherwise (not success or return is not true), we need to perform further checks
if iszero(and(success, eq(mload(0x00), 1))) {
// if the call was a failure and bubble is enabled, bubble the error
if and(iszero(success), bubble) {
returndatacopy(fmp, 0x00, returndatasize())
revert(fmp, returndatasize())
}
// if the return value is not true, then the call is only successful if:
// - the token address has code
// - the returndata is empty
success := and(success, and(iszero(returndatasize()), gt(extcodesize(token), 0)))
}
mstore(0x40, fmp)
}
}
}
lib/openzeppelin-contracts/contracts/token/ERC721/IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC721/IERC721.sol)
pragma solidity >=0.6.2;
import {IERC165} from "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC-721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon
* a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC-721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must have been allowed to move this token by either {approve} or
* {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon
* a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC-721
* or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
* understand this adds an external call which potentially creates a reentrancy vulnerability.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the address zero.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
}
lib/openzeppelin-contracts/contracts/token/ERC721/IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC721/IERC721Receiver.sol)
pragma solidity >=0.5.0;
/**
* @title ERC-721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC-721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be
* reverted.
*
* The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
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/ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.5.0) (utils/ReentrancyGuard.sol)
pragma solidity ^0.8.20;
import {StorageSlot} from "./StorageSlot.sol";
/**
* @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].
*
* IMPORTANT: Deprecated. This storage-based reentrancy guard will be removed and replaced
* by the {ReentrancyGuardTransient} variant in v6.0.
*
* @custom:stateless
*/
abstract contract ReentrancyGuard {
using StorageSlot for bytes32;
// keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff))
bytes32 private constant REENTRANCY_GUARD_STORAGE =
0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00;
// 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;
/**
* @dev Unauthorized reentrant call.
*/
error ReentrancyGuardReentrantCall();
constructor() {
_reentrancyGuardStorageSlot().getUint256Slot().value = 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();
}
/**
* @dev A `view` only version of {nonReentrant}. Use to block view functions
* from being called, preventing reading from inconsistent contract state.
*
* CAUTION: This is a "view" modifier and does not change the reentrancy
* status. Use it only on view functions. For payable or non-payable functions,
* use the standard {nonReentrant} modifier instead.
*/
modifier nonReentrantView() {
_nonReentrantBeforeView();
_;
}
function _nonReentrantBeforeView() private view {
if (_reentrancyGuardEntered()) {
revert ReentrancyGuardReentrantCall();
}
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be NOT_ENTERED
_nonReentrantBeforeView();
// Any calls to nonReentrant after this point will fail
_reentrancyGuardStorageSlot().getUint256Slot().value = ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_reentrancyGuardStorageSlot().getUint256Slot().value = 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 _reentrancyGuardStorageSlot().getUint256Slot().value == ENTERED;
}
function _reentrancyGuardStorageSlot() internal pure virtual returns (bytes32) {
return REENTRANCY_GUARD_STORAGE;
}
}
lib/openzeppelin-contracts/contracts/utils/StorageSlot.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/StorageSlot.sol)
// This file was procedurally generated from scripts/generate/templates/StorageSlot.js.
pragma solidity ^0.8.20;
/**
* @dev Library for reading and writing primitive types to specific storage slots.
*
* Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.
* This library helps with reading and writing to such slots without the need for inline assembly.
*
* The functions in this library return Slot structs that contain a `value` member that can be used to read or write.
*
* Example usage to set ERC-1967 implementation slot:
* ```solidity
* contract ERC1967 {
* // Define the slot. Alternatively, use the SlotDerivation library to derive the slot.
* bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;
*
* function _getImplementation() internal view returns (address) {
* return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;
* }
*
* function _setImplementation(address newImplementation) internal {
* require(newImplementation.code.length > 0);
* StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;
* }
* }
* ```
*
* TIP: Consider using this library along with {SlotDerivation}.
*/
library StorageSlot {
struct AddressSlot {
address value;
}
struct BooleanSlot {
bool value;
}
struct Bytes32Slot {
bytes32 value;
}
struct Uint256Slot {
uint256 value;
}
struct Int256Slot {
int256 value;
}
struct StringSlot {
string value;
}
struct BytesSlot {
bytes value;
}
/**
* @dev Returns an `AddressSlot` with member `value` located at `slot`.
*/
function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `BooleanSlot` with member `value` located at `slot`.
*/
function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Bytes32Slot` with member `value` located at `slot`.
*/
function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Uint256Slot` with member `value` located at `slot`.
*/
function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `Int256Slot` with member `value` located at `slot`.
*/
function getInt256Slot(bytes32 slot) internal pure returns (Int256Slot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns a `StringSlot` with member `value` located at `slot`.
*/
function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns an `StringSlot` representation of the string storage pointer `store`.
*/
function getStringSlot(string storage store) internal pure returns (StringSlot storage r) {
assembly ("memory-safe") {
r.slot := store.slot
}
}
/**
* @dev Returns a `BytesSlot` with member `value` located at `slot`.
*/
function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) {
assembly ("memory-safe") {
r.slot := slot
}
}
/**
* @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`.
*/
function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) {
assembly ("memory-safe") {
r.slot := store.slot
}
}
}
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/FeeSplitter.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {LaunchConfig} from "./LaunchConfig.sol";
import {IAmmAdapter} from "./interfaces/IAmmAdapter.sol";
import {ISwapRouterMinimal, ISwapRouter02Minimal} from "./interfaces/IUniswapV3Minimal.sol";
/// @dev The locker's own quote asset, read rather than imported: LiquidityLocker
/// imports this file, so the dependency cannot run both ways.
interface IQuoteTokenSource {
function quoteToken() external view returns (address);
}
/// @dev The factory's hooks and their PoolManager, read rather than imported
/// for the same reason: TokenFactory imports this file.
interface IHookedFactory {
function taxHook() external view returns (address);
function sniperHook() external view returns (address);
}
interface IHookPoolManager {
function poolManager() external view returns (address);
}
/**
* Splits the mandatory 1% native pool fee 75% creator / 25% platform, for
* every launched token (spec §4.1). Two legs, not three: this platform has no
* rewards program, so there is no third bucket and no `rewardsPool`.
*
* Fees accrue in whichever token was swapped in, so a single collection can
* hand this contract balances of both the launched token and WETH —
* `distribute` splits both sides using the same percentages.
*
* One creator recipient per token, not a list (spec §4.3, "no split fees").
* The creator can repoint their own payout address at any time; they cannot
* fan it out across several addresses with custom weights, which is a feature
* Arcantis grew and this platform deliberately doesn't have.
*
* Only `liquidityLocker` may call `distribute`: it's the one contract that
* actually pulls real pool fees (via the venue's NonfungiblePositionManager,
* spec §4.1.1), so trusting its reported amounts is safe. An unauthenticated
* caller could otherwise claim an inflated amount for a token whose real
* fee collection sent this contract a smaller (or no) balance.
*
* `tokenFactory` is wired in once, post-deploy: FeeSplitter, LiquidityLocker,
* and TokenFactory each need one of the others' addresses, so something has
* to be settable after construction to break the cycle — TokenFactory is
* deployed last (once LiquidityLocker and FeeSplitter already exist), so
* it's the one address FeeSplitter can't know at construction time.
*/
contract FeeSplitter is Ownable {
using SafeERC20 for IERC20;
uint256 private constant BPS_DENOMINATOR = 10_000;
uint256 private constant CREATOR_BPS = 7_500;
LaunchConfig public immutable launchConfig;
address public immutable liquidityLocker;
address public tokenFactory;
/// @dev Where this token's 75% creator share is paid. Set at registerToken
/// time, repointable by the creator (or the owner, as a support backstop).
mapping(address token => address recipient) public creatorRecipient;
/// @dev Set once at registerToken time -- the only address allowed to
/// change this token's payout address via `setRecipient`.
mapping(address token => address creator) public creatorOf;
/**
* Whether the platform's share of a launched token is sold for the pool's
* quote asset before reaching the treasury.
*
* A switch rather than a constant because it is a genuine trade-off, not a
* settled question. On, the treasury only ever holds ETH or a stablecoin
* and takes no position in anyone's launch. Off, it holds the tokens and
* can sell them when and how it chooses.
*
* The cost of "on" is visible: it sells a slice of every launch into that
* launch's own pool on every collection. Small, but constant, and on a
* platform whose pitch is that creators keep 75%, being seen to sell into
* their chart hourly is worth thinking about. Hence a switch — this can be
* turned off in one transaction if it turns out to be the wrong call.
*/
bool public convertPlatformShare;
/**
* The platform's share, held here until somebody converts it on purpose.
*
* Conversion used to happen inside `distribute`, which runs inside
* `LiquidityLocker.collectFees`, which anyone may call. That put a swap
* with no minimum output into a transaction an outsider chooses the moment
* of: sell into the launch pool, call collectFees so the platform's share
* is sold at the bottom, buy back. Three transactions in a row, no
* mempool needed, and the keeper reimbursement paid for the trigger.
*
* So the two are separated. `distribute` only ever books the share here;
* `convertPending` sells it, with a minimum the caller must state and
* only for callers the owner named. What is in hand stays in hand until
* then — or is released in kind by the owner.
*/
mapping(address feeToken => uint256 amount) public pendingPlatform;
/// @notice A creator share the recipient could not receive (a blocklist,
/// a paused token), paid to whoever the recipient is by then.
mapping(address token => mapping(address feeToken => uint256 amount)) public unpaidCreator;
/// @dev Who may convert the pending share. The keeper's key, typically.
mapping(address caller => bool allowed) public authorizedConverter;
event AuthorizedConverterSet(address indexed caller, bool allowed);
event PlatformSharePending(address indexed feeToken, uint256 amount, uint256 totalPending);
event CreatorPayoutFailed(address indexed token, address indexed feeToken, address recipient, uint256 amount);
event PlatformShareReleased(address indexed feeToken, uint256 amount);
/**
* What the platform actually wants to end up holding. WETH here.
*
* Without this, converting the platform's share stops at the pool's quote
* asset, which is right for an ETH-quoted pool and wrong for every other
* kind. A MEME/NVDA pool would hand the treasury NVDA — a tokenized equity
* the platform never chose to hold, and one that excludes US persons.
* "We only want ETH" has to mean ETH regardless of what the pool is quoted
* in, so there is a second hop.
*
* Settable rather than immutable: if this is ever wrong, being able to fix
* it without redeploying the suite is worth one storage slot. Zero disables
* the second hop entirely and the treasury keeps the quote asset.
*/
address public platformPayoutToken;
/**
* How to get from a given quote asset to `platformPayoutToken`.
*
* Per-asset rather than a single rule, because the fee tiers genuinely
* differ: on Robinhood Chain, MSTR/WETH liquidity sits at 1%, NVDA/WETH at
* 0.3%, and SPY/WETH at 0.05%. The AMM adapters hardcode 1% (that is the
* tier this platform launches into), so routing this hop through them
* would silently fail for eight of the ten registered equities and pay the
* platform in stock while appearing to work.
*
* An unset route is not an error — it means "keep this asset", which is
* the right default for a dollar stablecoin like USDG.
*/
struct PayoutRoute {
address router;
uint24 fee;
}
mapping(address quote => PayoutRoute) public payoutRoute;
/**
* The swap router behind each AMM adapter, for the first hop.
*
* This contract deliberately does NOT route the first hop through the
* adapter itself. `IAmmAdapter`'s convention is that the caller transfers
* tokens in before calling, and the adapter never approves this contract
* back — so a failed swap would leave the tokens stranded on the adapter,
* and the recovery `transferFrom` would revert on allowance and take the
* whole `collectFees` down with it. That is the exact failure the
* try/catch here exists to prevent.
*
* Talking to the router directly keeps custody in this contract: on
* failure the approval is reset and the tokens are simply paid in kind.
*/
mapping(address adapter => address router) public venueRouter;
/// @dev The tier every launch pool is created at, mirroring
/// `LaunchConfig.QUICK_LAUNCH_FEE_TIER`. The first hop trades the launched
/// token against its own pool, so this is known rather than configured.
uint24 private constant LAUNCH_FEE_TIER = 10_000;
event TokenFactorySet(address indexed tokenFactory);
event PlatformPayoutTokenUpdated(address indexed token);
event PayoutRouteSet(address indexed quote, address indexed router, uint24 fee);
event VenueRouterSet(address indexed adapter, address indexed router);
event PlatformPayoutSwapped(
address indexed quote,
address indexed payoutToken,
uint256 amountIn,
uint256 amountOut
);
event PlatformPayoutSwapFailed(address indexed quote, uint256 amount);
event ConvertPlatformShareUpdated(bool enabled);
event PlatformShareConverted(address indexed feeToken, address indexed quote, uint256 amountIn, uint256 amountOut);
event PlatformShareConversionFailed(address indexed feeToken, uint256 amount);
event TokenRegistered(address indexed token, address indexed creator, address recipient);
event RecipientUpdated(address indexed token, address recipient);
event FeesDistributed(
address indexed token,
address indexed feeToken,
uint256 creatorAmount,
uint256 platformAmount
);
modifier onlyTokenFactory() {
require(msg.sender == tokenFactory, "not factory");
_;
}
modifier onlyLiquidityLocker() {
require(msg.sender == liquidityLocker, "not locker");
_;
}
/// @dev The contract owner (platform admin) can repoint any token's recipient too --
/// a support-and-recovery backstop for creators who've lost wallet access, not a
/// routine path. Every other owner-only function on this contract is one-time wiring
/// (setTokenFactory); this is the only one that reaches into live, per-token state.
modifier onlyCreatorOrOwner(address token) {
require(msg.sender == creatorOf[token] || msg.sender == owner(), "not creator or owner");
_;
}
constructor(LaunchConfig launchConfig_, address liquidityLocker_, address owner_) Ownable(owner_) {
require(address(launchConfig_) != address(0), "config=0");
require(liquidityLocker_ != address(0), "locker=0");
launchConfig = launchConfig_;
liquidityLocker = liquidityLocker_;
}
/// @notice One-time wiring call, run immediately after TokenFactory is deployed (see script/DeployQuickLaunch.s.sol).
function setTokenFactory(address tokenFactory_) external onlyOwner {
require(tokenFactory == address(0), "already set");
require(tokenFactory_ != address(0), "factory=0");
tokenFactory = tokenFactory_;
emit TokenFactorySet(tokenFactory_);
}
/// @notice Records where a newly launched token's 75% creator share is paid.
function registerToken(address token, address creator, address recipient) external onlyTokenFactory {
require(creator != address(0), "creator=0");
require(recipient != address(0), "recipient=0");
creatorOf[token] = creator;
creatorRecipient[token] = recipient;
emit TokenRegistered(token, creator, recipient);
}
/// @notice Lets a token's creator -- or the platform owner, as a support backstop --
/// repoint where its 75% creator share of the mandatory fee is paid, at any time.
///
/// Refuses the same addresses the factory refuses at launch
/// (`TokenFactory._requireReachableRecipient`): the locker, this splitter,
/// either hook and their PoolManager. Paying one of the first four is a
/// transfer to a contract that books it to nobody; paying the PoolManager
/// settles whoever holds the unlock, so anyone could take the creator's
/// hook-charged leg (audit 2026-10-03 HK-1).
function setRecipient(address token, address recipient) external onlyCreatorOrOwner(token) {
require(recipient != address(0), "recipient=0");
require(
recipient != liquidityLocker && recipient != address(this) && !_isHookOrPoolManager(recipient),
"recipient is a protocol contract"
);
creatorRecipient[token] = recipient;
emit RecipientUpdated(token, recipient);
}
/// @dev Whether `account` is one of the factory's hooks or a hook's
/// PoolManager. A factory with no hooks (a Quick-only suite), or one
/// not yet wired, has none to refuse; a read that fails counts as none.
function _isHookOrPoolManager(address account) private view returns (bool) {
address factory = tokenFactory;
if (factory.code.length == 0) return false;
address[2] memory hooks = [
_addressFrom(factory, abi.encodeCall(IHookedFactory.taxHook, ())),
_addressFrom(factory, abi.encodeCall(IHookedFactory.sniperHook, ()))
];
for (uint256 i; i < 2; ++i) {
address hook = hooks[i];
if (hook == address(0)) continue;
if (account == hook) return true;
if (account == _addressFrom(hook, abi.encodeCall(IHookPoolManager.poolManager, ()))) return true;
}
return false;
}
/// @dev Zero when the read fails or does not return exactly one word.
function _addressFrom(address target, bytes memory data) private view returns (address out) {
(bool ok, bytes memory ret) = target.staticcall(data);
if (ok && ret.length == 32) out = address(uint160(uint256(bytes32(ret))));
}
/// @notice Splits and pays out `amount0`/`amount1` of `token0`/`token1`, already held by this contract, for `token`'s registered creator recipient.
function distribute(
address token,
address token0,
uint256 amount0,
address token1,
uint256 amount1,
address quote,
IAmmAdapter adapter
) external onlyLiquidityLocker {
if (amount0 > 0) _distributeOne(token, token0, amount0, quote, adapter);
if (amount1 > 0) _distributeOne(token, token1, amount1, quote, adapter);
}
function _distributeOne(
address token,
address feeToken,
uint256 amount,
address quote,
IAmmAdapter adapter
) private {
address recipient = creatorRecipient[token];
require(recipient != address(0), "token not registered");
// Platform takes the remainder rather than its own rounded product, so
// integer-division dust can never strand a wei in this contract.
uint256 creatorAmount = (amount * CREATOR_BPS) / BPS_DENOMINATOR;
uint256 platformAmount = amount - creatorAmount;
IERC20 erc20 = IERC20(feeToken);
// The creator is always paid in kind. They chose to hold this token by
// launching it, and converting on their behalf is not ours to decide.
if (creatorAmount > 0 && !_tryTransfer(erc20, recipient, creatorAmount)) {
unpaidCreator[token][feeToken] += creatorAmount;
emit CreatorPayoutFailed(token, feeToken, recipient, creatorAmount);
}
if (platformAmount > 0) {
if (convertPlatformShare) {
// Booked, not sold: see `pendingPlatform`. `quote` and `adapter`
// are supplied again by whoever converts, because a swap inside
// this call is what made the share sandwichable.
quote; adapter;
pendingPlatform[feeToken] += platformAmount;
emit PlatformSharePending(feeToken, platformAmount, pendingPlatform[feeToken]);
} else if (!_tryTransfer(erc20, launchConfig.platformTreasury(), platformAmount)) {
pendingPlatform[feeToken] += platformAmount;
emit PlatformSharePending(feeToken, platformAmount, pendingPlatform[feeToken]);
}
}
emit FeesDistributed(token, feeToken, creatorAmount, platformAmount);
}
/// @notice Permissionless: pays a parked creator share to the current recipient.
function payUnpaidCreator(address token, address feeToken) external {
uint256 amount = unpaidCreator[token][feeToken];
require(amount > 0, "nothing unpaid");
unpaidCreator[token][feeToken] = 0;
IERC20(feeToken).safeTransfer(creatorRecipient[token], amount);
emit FeesDistributed(token, feeToken, amount, 0);
}
function _tryTransfer(IERC20 erc20, address to, uint256 amount) private returns (bool) {
(bool ok, bytes memory ret) = address(erc20).call(abi.encodeCall(IERC20.transfer, (to, amount)));
return ok && (ret.length == 0 ? address(erc20).code.length > 0 : abi.decode(ret, (bool)));
}
modifier onlyConverter() {
require(msg.sender == owner() || authorizedConverter[msg.sender], "not converter");
_;
}
/// @notice Names (or removes) a caller allowed to convert the pending platform share.
function setAuthorizedConverter(address caller, bool allowed) external onlyOwner {
require(caller != address(0), "caller=0");
authorizedConverter[caller] = allowed;
emit AuthorizedConverterSet(caller, allowed);
}
/**
* Sell `amount` of a held fee token for what the platform wants to hold,
* in up to two hops, each with a floor the caller states:
*
* feeToken --(hop 1, the launch pool)--> quote --(hop 2)--> payout token
*
* Every hop must clear its minimum or the whole call reverts and the
* share stays booked. That is the point: a failed conversion is a retry,
* never a fire sale. The caller (the keeper, or the owner) is expected to
* quote first and pass a minimum a few percent under the quote. The
* routers are still the owner's: `venueRouter[adapter]` and
* `payoutRoute[quote]`, never an argument.
*
* `feeToken == quote` is the quote leg of a collection and skips hop 1.
* A zero `platformPayoutToken`, a quote that already is the payout token,
* or an unset payout route ends the conversion at the quote asset, which
* is delivered to the treasury as is (that is how a stablecoin is kept).
*/
function convertPending(
address feeToken,
address quote,
IAmmAdapter adapter,
uint256 amount,
uint256 minOutHop1,
uint256 minOutHop2
) external onlyConverter returns (uint256 delivered) {
require(amount > 0 && amount <= pendingPlatform[feeToken], "amount exceeds pending");
// The counter-asset of hop 1, which is to say the pool hop 1 trades
// through. Without this the docstring above was wrong: the routers were
// the owner's, but the caller chose what to sell into, and a converter
// key could sell the platform's share into a pool of its own making at
// a price of its own choosing. The treasury still received the output,
// so it did not read as theft -- it read as a bad fill, while the real
// asset sat in the caller's pool.
require(_isApprovedQuote(quote), "quote not approved");
pendingPlatform[feeToken] -= amount;
address treasury = launchConfig.platformTreasury();
address held = feeToken;
uint256 holding = amount;
if (held != quote) {
address router = venueRouter[address(adapter)];
require(router != address(0), "no venue router");
(bool ok, uint256 out) = _swap(router, held, quote, LAUNCH_FEE_TIER, holding, address(this));
require(ok && out >= minOutHop1, "hop 1 under minimum");
emit PlatformShareConverted(held, quote, holding, out);
held = quote;
holding = out;
}
address payoutToken = platformPayoutToken;
PayoutRoute memory route = payoutRoute[held];
if (payoutToken == address(0) || held == payoutToken || route.router == address(0)) {
IERC20(held).safeTransfer(treasury, holding);
return holding;
}
(bool swapped, uint256 received) = _swap(route.router, held, payoutToken, route.fee, holding, treasury);
require(swapped && received >= minOutHop2, "hop 2 under minimum");
emit PlatformPayoutSwapped(held, payoutToken, holding, received);
return received;
}
/**
* Whether an asset is one this platform actually quotes pools in.
*
* Mirrors what TokenFactory will accept at launch, so the set matches by
* construction: either the chain's own wrapped-native quote, which is
* deliberately not in `quoteAssets` and keeps its own path, or an asset the
* owner registered and enabled there.
*
* Read off the locker rather than stored, so it cannot drift from the
* quote the locker actually records against a pool.
*/
function _isApprovedQuote(address quote) private view returns (bool) {
if (quote == address(0)) return false;
if (quote == IQuoteTokenSource(liquidityLocker).quoteToken()) return true;
(bool enabled, , , ) = launchConfig.quoteAssets(quote);
return enabled;
}
/// @notice Hands a held platform share to the treasury in kind, without a swap.
function releasePending(address feeToken, uint256 amount) external onlyOwner {
require(amount > 0 && amount <= pendingPlatform[feeToken], "amount exceeds pending");
pendingPlatform[feeToken] -= amount;
IERC20(feeToken).safeTransfer(launchConfig.platformTreasury(), amount);
emit PlatformShareReleased(feeToken, amount);
}
/**
* One hop through a Uniswap-V3-style router, with custody kept here.
*
* `amountOutMinimum` is 0 deliberately: this is the platform's own share,
* the amounts are small, and a slippage bound that reverts would defeat
* the fallbacks above — the platform bears its own execution risk rather
* than pushing it onto the creator.
*
* The approval is reset on failure so a stuck allowance cannot accumulate
* against a router that has already misbehaved once.
*/
function _swap(
address router,
address tokenIn,
address tokenOut,
uint24 fee,
uint256 amountIn,
address recipient
) private returns (bool, uint256) {
IERC20(tokenIn).forceApprove(router, amountIn);
/* Uniswap shipped two swap routers and both are in use here.
*
* The original's ExactInputSingleParams carries a `deadline`, selector
* 0x414bf389; SwapRouter02 dropped it, selector 0x04e45aaf. Calling the
* wrong one matches no function, falls through to the router's fallback
* and reverts with empty returndata -- which this method's catch would
* read as "the swap failed", quietly paying the platform in kind
* forever while looking like thin liquidity.
*
* Which one a given router is cannot be derived from its address, and
* it is genuinely mixed: on Robinhood mainnet the Uniswap router is
* SwapRouter02 and the SushiSwap one is the original. Rather than carry
* a flag per route -- more owner surface, and one more thing to set
* wrong -- the newer encoding is tried first and the older second. A
* router only ever answers one of them, so the wrong attempt costs a
* reverted staticcall's worth of gas and nothing else.
*/
try
ISwapRouter02Minimal(router).exactInputSingle(
ISwapRouter02Minimal.ExactInputSingleParams({
tokenIn: tokenIn,
tokenOut: tokenOut,
fee: fee,
recipient: recipient,
amountIn: amountIn,
amountOutMinimum: 0,
sqrtPriceLimitX96: 0
})
)
returns (uint256 out) {
return (true, out);
} catch {
// Fall through to the original ABI.
}
try
ISwapRouterMinimal(router).exactInputSingle(
ISwapRouterMinimal.ExactInputSingleParams({
tokenIn: tokenIn,
tokenOut: tokenOut,
fee: fee,
recipient: recipient,
deadline: block.timestamp,
amountIn: amountIn,
amountOutMinimum: 0,
sqrtPriceLimitX96: 0
})
)
returns (uint256 out) {
return (true, out);
} catch {
IERC20(tokenIn).forceApprove(router, 0);
return (false, 0);
}
}
/// @notice Turns conversion of the platform's share on or off, without a
/// redeploy. Off means the treasury receives launched tokens in kind.
function setConvertPlatformShare(bool enabled) external onlyOwner {
convertPlatformShare = enabled;
emit ConvertPlatformShareUpdated(enabled);
}
/// @notice Sets what the platform ends up holding. Zero disables the second
/// hop, leaving the treasury with each pool's quote asset.
function setPlatformPayoutToken(address token) external onlyOwner {
platformPayoutToken = token;
emit PlatformPayoutTokenUpdated(token);
}
/**
* @notice Sets how a quote asset reaches `platformPayoutToken`.
*
* The fee tier is explicit because it varies per asset and getting it wrong
* is silent: the swap simply reverts into the fallback and the treasury
* keeps the quote asset. Pass a zero router to clear a route, which is how
* an asset is marked "keep as-is".
*/
function setPayoutRoute(address quote, address router, uint24 fee) external onlyOwner {
require(quote != address(0), "quote=0");
payoutRoute[quote] = PayoutRoute(router, fee);
emit PayoutRouteSet(quote, router, fee);
}
/// @notice Points an AMM adapter at the router behind it, for the first hop.
/// Repointable rather than one-time: a venue's router can be replaced, and
/// an unset one degrades to paying in kind rather than reverting.
function setVenueRouter(address adapter, address router) external onlyOwner {
require(adapter != address(0), "adapter=0");
venueRouter[adapter] = router;
emit VenueRouterSet(adapter, router);
}
}
src/LaunchConfig.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
/// @dev Chainlink's standard read surface. Declared here rather than pulled in
/// as a dependency because this is the only function any of these contracts calls.
interface IAggregatorV3 {
function latestRoundData()
external
view
returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);
}
/**
* Admin-adjustable platform defaults that TokenFactory reads at the moment
* of each new deployment (spec §9). Changing a default only affects tokens
* launched *after* the change — TokenFactory reads these values once during
* the launch transaction and never references LaunchConfig again for that
* token, so already-live tokens keep whatever was in effect at their own
* creation.
*
* Phase 2 (Quick Launch) fields plus Phase 5 (Advanced mode, spec §4.1.b)
* additions: graduation threshold, the curve's own starting valuation, and
* the creator-tax floor.
*/
contract LaunchConfig is Ownable {
/// @dev The AMM venues a launch or graduation can seed liquidity into (multi-venue
/// launches). UniswapV3 supports single-sided seeding (Quick Launch's zero-USDC
/// pitch); SushiV3 is an unmodified Uniswap V3 fork with the same capability
/// (see SushiV3Adapter's docstring) — both work identically on both launch types.
enum AmmVenue {
UniswapV3,
SushiV3,
UniswapV4
}
/// @dev Each venue's IAmmAdapter instance, admin-settable so a venue's adapter can
/// be swapped without redeploying TokenFactory/AdvancedTokenFactory. Same "read once
/// at launch time" rule as every other LaunchConfig value: a token/curve already
/// launched keeps whatever adapter it resolved at its own creation forever (each
/// LiquidityLocker position and AdvancedToken instance holds its own adapter
/// reference directly) — changing this mapping only affects launches after the change.
mapping(AmmVenue => address) public ammAdapter;
event AmmAdapterSet(AmmVenue indexed venue, address indexed adapter);
function setAmmAdapter(AmmVenue venue, address adapter) external onlyOwner {
require(adapter != address(0), "adapter=0");
ammAdapter[venue] = adapter;
emit AmmAdapterSet(venue, adapter);
}
address private _stakingVaultDeployer;
/// @notice Acts at once where the owner, a timelock, cannot: pauses
/// staking launches here and new stakes on a vault. Cannot move
/// funds or block an exit.
address public guardian;
bool public stakingLaunchesPaused;
event StakingVaultDeployerSet(address indexed deployer);
event GuardianSet(address indexed guardian);
event StakingLaunchesPaused(bool paused);
/// @dev Zero disables launches that need a vault, which is how the pause
/// reaches the factory without the factory knowing about it.
function stakingVaultDeployer() external view returns (address) {
return stakingLaunchesPaused ? address(0) : _stakingVaultDeployer;
}
function setStakingVaultDeployer(address deployer) external onlyOwner {
_stakingVaultDeployer = deployer;
emit StakingVaultDeployerSet(deployer);
}
function setGuardian(address guardian_) external onlyOwner {
guardian = guardian_;
emit GuardianSet(guardian_);
}
function setStakingLaunchesPaused(bool paused) external {
require(msg.sender == guardian || msg.sender == owner(), "not guardian");
stakingLaunchesPaused = paused;
emit StakingLaunchesPaused(paused);
}
/// @dev Chainlink USD feeds report 8 decimals; `startingMcapUsd` uses the
/// same scale so the conversion below is a straight divide.
uint8 public constant USD_DECIMALS = 8;
/// @dev How stale an ETH/USD answer may be before we stop trusting it.
uint256 public constant MAX_PRICE_AGE = 6 hours;
/// @dev After an L2 sequencer comes back up, feeds need a moment to catch
/// up; a price read inside this window is treated as untrustworthy.
uint256 public constant SEQUENCER_GRACE_PERIOD = 1 hours;
/// @dev The only fee tier Quick Launch pools use (spec §4.1.a) — Uniswap V3 encodes 1.00% as 10000.
uint24 public constant QUICK_LAUNCH_FEE_TIER = 10_000;
/// @dev Basis points, both launch types (spec §4.2) — the native Uniswap
/// V3 pool fee post-launch/post-graduation, or BondingCurve's own
/// matching deduction pre-graduation (spec §4.1.b). Not admin-adjustable:
/// it's tied to the fixed 1.00% Uniswap fee tier every pool uses.
uint16 public constant MANDATORY_BASE_TAX_BPS = 100;
/// @dev The implied market cap a pool opens at, in USD (spec §4.2). No ETH
/// changes hands for this — TokenFactory deposits the new token's entire
/// supply single-sided (see its docstring), and this value only picks the
/// tick range/starting price. Real ETH only enters the pool once someone
/// actually buys.
///
/// Denominated in USD rather than wei because that's the figure the product
/// promises. The pool needs it in wei, so `startingMcapQuoteWei()` converts
/// at launch time against a live ETH/USD feed.
uint256 public startingMcapUsd = 2_700 * 10 ** USD_DECIMALS;
/// @dev Used whenever the ETH/USD feed can't be trusted — unset, stale,
/// non-positive, or the sequencer is down. Launching at a slightly stale
/// peg is a far better failure mode than a launchpad where nobody can
/// launch anything because an oracle hiccuped, so this fails *open*.
/// Also the only path on a network with no Chainlink deployment at all,
/// which is the case on Robinhood testnet today.
uint256 public fallbackStartingMcapWei = 0.75 ether;
/// @dev Flat fee charged at deploy time, in native ETH.
uint256 public launchFeeWei = 0.0005 ether;
uint256 public minTotalSupply = 1 ether;
uint256 public maxTotalSupply = 10_000_000_000 ether;
/// @dev Chainlink ETH/USD aggregator proxy. Zero means "no feed configured"
/// and the fallback above is used unconditionally.
address public ethUsdFeed;
/// @dev Chainlink L2 sequencer uptime feed. Robinhood Chain is an L2, and
/// its own oracle docs are explicit that a price must not be trusted while
/// the sequencer is down. Zero disables the check.
address public sequencerUptimeFeed;
/// @dev Receives the platform's 25% fee share (FeeSplitter) and the flat launch fee (TokenFactory).
address public platformTreasury;
/**
* A quote asset a launch is allowed to pair against — the other side of the
* pool, the thing buyers pay with and the thing the price is denominated in.
*
* An allowlist rather than "any ERC-20 the creator names" on purpose. The
* starting price is derived from the quote asset's USD value, so a creator
* free to nominate a token they control could mint themselves an arbitrary
* balance, declare it worth anything, and open a pool at a market cap of
* their choosing. Governance decides what counts as money here.
*
* `decimals` is stored rather than read from the token because a quote
* asset that lies about its own decimals() would corrupt the starting
* price, and because reading it costs a call on every launch.
*/
struct QuoteAsset {
bool enabled;
uint8 decimals;
/// @dev Chainlink <asset>/USD proxy. Zero, stale or non-positive falls
/// back to `fixedUsdPrice`, matching how the ETH path fails open.
address usdFeed;
/// @dev USD_DECIMALS scale. For a dollar stablecoin this is simply
/// 1 * 10**USD_DECIMALS. Required — an asset with neither a live feed
/// nor a configured price cannot be priced, and is rejected at launch
/// rather than defaulted to something invented.
uint256 fixedUsdPrice;
}
/// @dev Keyed by token address. The native/WETH quote is deliberately NOT
/// registered here: it keeps its own `startingMcapQuoteWei()` path, which
/// is already deployed, smoke-tested on-chain and has its own fail-open
/// fallback expressed as an amount rather than a price.
mapping(address => QuoteAsset) public quoteAssets;
event QuoteAssetSet(address indexed token, bool enabled, uint8 decimals, address usdFeed, uint256 fixedUsdPrice);
function setQuoteAsset(
address token,
bool enabled,
uint8 decimals_,
address usdFeed,
uint256 fixedUsdPrice
) external onlyOwner {
require(token != address(0), "token=0");
// Guards the exponent below: 10**77 still fits uint256, 10**78 does not.
require(decimals_ <= 36, "decimals too large");
// Without one of the two there is no way to price the asset, and a
// launch against it would have to invent a starting market cap.
require(!enabled || usdFeed != address(0) || fixedUsdPrice > 0, "no price source");
quoteAssets[token] = QuoteAsset(enabled, decimals_, usdFeed, fixedUsdPrice);
emit QuoteAssetSet(token, enabled, decimals_, usdFeed, fixedUsdPrice);
}
/**
* The starting market cap expressed in units of `token`, for a pool quoted
* in something other than native ETH.
*
* Same idea as `startingMcapQuoteWei()` — convert the USD figure the
* product promises into whatever the pool actually counts in — but general
* over decimals and price source. Reverts for an unregistered or disabled
* asset, because the alternative is opening a pool at a fabricated price.
*/
function startingMcapInQuote(address token) public view returns (uint256) {
QuoteAsset memory asset = quoteAssets[token];
require(asset.enabled, "quote asset not allowed");
uint256 priceUsd = asset.fixedUsdPrice;
if (asset.usdFeed != address(0) && asset.usdFeed.code.length > 0 && _sequencerHealthy()) {
(, int256 answer, , uint256 updatedAt, ) = IAggregatorV3(asset.usdFeed).latestRoundData();
if (answer > 0 && updatedAt != 0 && block.timestamp - updatedAt <= MAX_PRICE_AGE) {
priceUsd = uint256(answer);
}
}
require(priceUsd > 0, "no quote price");
// startingMcapUsd and priceUsd share USD_DECIMALS, so they cancel and
// the decimals exponent alone sets the scale.
return (startingMcapUsd * 10 ** asset.decimals) / priceUsd;
}
/// @dev Extracted from `startingMcapQuoteWei()` unchanged so both price
/// paths refuse to read a feed while the L2 sequencer is down or still
/// inside its post-recovery grace window.
function _sequencerHealthy() private view returns (bool) {
if (sequencerUptimeFeed == address(0) || sequencerUptimeFeed.code.length == 0) return true;
(, int256 up, uint256 startedAt, , ) = IAggregatorV3(sequencerUptimeFeed).latestRoundData();
// 1 == sequencer is down.
if (up != 0) return false;
return block.timestamp - startedAt >= SEQUENCER_GRACE_PERIOD;
}
event StartingMcapUsdUpdated(uint256 value);
event FallbackStartingMcapWeiUpdated(uint256 value);
event LaunchFeeWeiUpdated(uint256 value);
event SupplyBoundsUpdated(uint256 min, uint256 max);
event PlatformTreasuryUpdated(address value);
event PriceFeedsUpdated(address ethUsdFeed, address sequencerUptimeFeed);
constructor(address owner_, address platformTreasury_) Ownable(owner_) {
require(platformTreasury_ != address(0), "treasury=0");
platformTreasury = platformTreasury_;
}
function setStartingMcapUsd(uint256 value) external onlyOwner {
require(value > 0, "mcap=0");
startingMcapUsd = value;
emit StartingMcapUsdUpdated(value);
}
function setFallbackStartingMcapWei(uint256 value) external onlyOwner {
require(value > 0, "fallback=0");
fallbackStartingMcapWei = value;
emit FallbackStartingMcapWeiUpdated(value);
}
function setLaunchFeeWei(uint256 value) external onlyOwner {
launchFeeWei = value;
emit LaunchFeeWeiUpdated(value);
}
function setPriceFeeds(address ethUsdFeed_, address sequencerUptimeFeed_) external onlyOwner {
ethUsdFeed = ethUsdFeed_;
sequencerUptimeFeed = sequencerUptimeFeed_;
emit PriceFeedsUpdated(ethUsdFeed_, sequencerUptimeFeed_);
}
/**
* The starting market cap expressed in wei, which is what the AMM adapter
* actually needs to pick a tick.
*
* Every failure path returns `fallbackStartingMcapWei` rather than
* reverting. That direction is deliberate: this value only sets a new
* pool's opening price, so a stale peg costs a little accuracy, whereas
* reverting would take the entire launch flow offline for as long as an
* oracle is unhealthy.
*/
function startingMcapQuoteWei() public view returns (uint256) {
if (ethUsdFeed == address(0) || ethUsdFeed.code.length == 0) return fallbackStartingMcapWei;
// Refuses while the sequencer is down, and during the grace window
// right after it returns while feeds are still catching up.
if (!_sequencerHealthy()) return fallbackStartingMcapWei;
(, int256 price, , uint256 updatedAt, ) = IAggregatorV3(ethUsdFeed).latestRoundData();
if (price <= 0) return fallbackStartingMcapWei;
if (updatedAt == 0 || block.timestamp - updatedAt > MAX_PRICE_AGE) return fallbackStartingMcapWei;
// Both sides carry USD_DECIMALS, so they cancel and 1e18 sets the scale.
return (startingMcapUsd * 1e18) / uint256(price);
}
function setSupplyBounds(uint256 min, uint256 max) external onlyOwner {
require(min > 0 && min <= max, "bad bounds");
minTotalSupply = min;
maxTotalSupply = max;
emit SupplyBoundsUpdated(min, max);
}
function setPlatformTreasury(address value) external onlyOwner {
require(value != address(0), "treasury=0");
platformTreasury = value;
emit PlatformTreasuryUpdated(value);
}
}
src/interfaces/IAmmAdapter.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
/**
* Common surface every AMM venue adapter implements (multi-venue launches —
* creators pick Uniswap V3 or Aerodrome Slipstream at launch time). TokenFactory,
* AdvancedTokenFactory, BondingCurve, AdvancedToken, and LiquidityLocker all talk
* to whichever venue a given token launched into exclusively through this
* interface — none of them import a venue-specific interface
* (IUniswapV3Minimal/IAerodromeSlipstreamMinimal) directly anymore. Every launch
* path picks its adapter once (at launch, or at graduation) and is permanently
* bound to it — there's no venue migration path, matching how a launched token's
* pool identity is permanent today.
*
* Deliberately narrow: no function here can ever decrease liquidity or move a
* locked position's NFT out of LiquidityLocker (see its own docstring's "no
* withdraw, ever" guarantee). This isn't just a convention — LiquidityLocker
* grants each adapter per-tokenId ERC-721 operator approval at registration time
* (see LiquidityLocker.registerPosition) purely so `collectFees` can call through
* to the venue's own `positionManager.collect`. That approval hands the adapter
* real operator rights at the protocol level, so every adapter implementation
* must never expose a decrease-liquidity or transfer passthrough — the guarantee
* lives in what each adapter chooses to implement, not in this interface alone.
*/
interface IAmmAdapter {
/// @notice The venue's own NFT position-manager contract (Uniswap V3's
/// NonfungiblePositionManager, or Aerodrome Slipstream's equivalent) —
/// exposed so callers needing a raw ERC-721 fact (ownerOf) can reach it
/// directly instead of the adapter proxying every read.
function positionManager() external view returns (address);
/// @notice Opens a new pool for `newToken`/`quoteToken` and seeds it
/// single-sided: 100% `newToken`, 0% `quoteToken` (Quick Launch). Caller
/// must transfer `newTokenAmount` of `newToken` to this adapter before
/// calling. `startingMcapQuote` over `totalSupply` picks the tick
/// range/starting price, same convention TokenFactory's inline math used
/// before this was an adapter.
function createSingleSidedPool(
address newToken,
address quoteToken,
uint256 newTokenAmount,
uint256 totalSupply,
uint256 startingMcapQuote,
address recipient
) external returns (address pool, uint256 tokenId, uint160 sqrtPriceX96);
/// @notice Opens a new pool for `newToken`/`quoteToken` and seeds it
/// two-sided with the exact amounts given (BondingCurve graduation).
/// Caller must transfer both amounts to this adapter before calling.
function createTwoSidedPool(
address newToken,
address quoteToken,
uint256 newTokenAmount,
uint256 quoteTokenAmount,
address recipient
) external returns (address pool, uint256 tokenId, uint160 sqrtPriceX96);
/// @notice Exact-input swap. Caller must transfer `amountIn` of `tokenIn`
/// to this adapter before calling.
function swapExactInput(
address tokenIn,
address tokenOut,
uint256 amountIn,
uint256 amountOutMinimum,
address recipient
) external returns (uint256 amountOut);
/// @notice Collects all accrued fees for `tokenId` into `recipient`.
/// Requires this adapter to hold per-tokenId ERC-721 operator approval
/// from whoever owns the position (LiquidityLocker grants this once, at
/// registration).
function collectFees(uint256 tokenId, address recipient) external returns (uint256 amount0, uint256 amount1);
/// @notice Adds liquidity to an existing position. Caller must transfer
/// both amounts to this adapter before calling. Purely additive, exactly
/// like the underlying venue's own increaseLiquidity — cannot remove or
/// withdraw anything.
function increaseLiquidity(
uint256 tokenId,
address token0,
address token1,
uint256 amount0Desired,
uint256 amount1Desired
) external returns (uint256 amount0, uint256 amount1);
}
src/interfaces/IUniswapV3Minimal.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
/**
* Deliberately minimal, hand-written interfaces covering only the functions
* Runitup's own contracts call on Uniswap V3's Factory/NonfungiblePositionManager.
* Importing the full v3-periphery source pulls in OpenZeppelin v3.x
* (`drafts/ERC20Permit.sol`, `math/SafeMath.sol`) which conflicts with the
* modern OpenZeppelin v5 this repo uses for its own contracts — the
* standard, common workaround for integrating with Uniswap V3 without
* recompiling it. The Factory/Router/PositionManager/Quoter themselves are
* deployed unmodified from Uniswap's official pre-compiled artifacts
* (script/deploy-uniswap-v3.ts), never compiled through this Foundry project.
*/
interface IUniswapV3FactoryMinimal {
function getPool(address tokenA, address tokenB, uint24 fee) external view returns (address pool);
}
/**
* Just enough of a V3 pool to ask what price it is actually at.
*
* `createAndInitializePoolIfNecessary` is a misleading name to build on: when
* the pool already exists it returns that pool at the price it already has and
* silently discards the one it was handed. So a launch could walk into a pool
* somebody else created and priced, and nothing in the transaction would say
* so. Reading slot0 back is how the adapter finds out.
*/
interface IUniswapV3PoolMinimal {
function slot0()
external
view
returns (
uint160 sqrtPriceX96,
int24 tick,
uint16 observationIndex,
uint16 observationCardinality,
uint16 observationCardinalityNext,
uint32 feeProtocol,
bool unlocked
);
function token0() external view returns (address);
function token1() external view returns (address);
function swap(
address recipient,
bool zeroForOne,
int256 amountSpecified,
uint160 sqrtPriceLimitX96,
bytes calldata data
) external returns (int256 amount0, int256 amount1);
}
interface INonfungiblePositionManagerMinimal {
struct MintParams {
address token0;
address token1;
uint24 fee;
int24 tickLower;
int24 tickUpper;
uint256 amount0Desired;
uint256 amount1Desired;
uint256 amount0Min;
uint256 amount1Min;
address recipient;
uint256 deadline;
}
function createAndInitializePoolIfNecessary(
address token0,
address token1,
uint24 fee,
uint160 sqrtPriceX96
) external payable returns (address pool);
function mint(
MintParams calldata params
) external payable returns (uint256 tokenId, uint128 liquidity, uint256 amount0, uint256 amount1);
function positions(
uint256 tokenId
)
external
view
returns (
uint96 nonce,
address operator,
address token0,
address token1,
uint24 fee,
int24 tickLower,
int24 tickUpper,
uint128 liquidity,
uint256 feeGrowthInside0LastX128,
uint256 feeGrowthInside1LastX128,
uint128 tokensOwed0,
uint128 tokensOwed1
);
struct CollectParams {
uint256 tokenId;
address recipient;
uint128 amount0Max;
uint128 amount1Max;
}
function collect(CollectParams calldata params) external payable returns (uint256 amount0, uint256 amount1);
struct IncreaseLiquidityParams {
uint256 tokenId;
uint256 amount0Desired;
uint256 amount1Desired;
uint256 amount0Min;
uint256 amount1Min;
uint256 deadline;
}
function increaseLiquidity(
IncreaseLiquidityParams calldata params
) external payable returns (uint128 liquidity, uint256 amount0, uint256 amount1);
function safeTransferFrom(address from, address to, uint256 tokenId) external;
function ownerOf(uint256 tokenId) external view returns (address);
}
/// @dev v3-periphery's original SwapRouter. Its params carry a `deadline`,
/// which makes the selector 0x414bf389.
interface ISwapRouterMinimal {
struct ExactInputSingleParams {
address tokenIn;
address tokenOut;
uint24 fee;
address recipient;
uint256 deadline;
uint256 amountIn;
uint256 amountOutMinimum;
uint160 sqrtPriceLimitX96;
}
function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);
}
/**
* SwapRouter02, from swap-router-contracts.
*
* The same call with `deadline` removed, which changes the struct and so
* changes the selector: 0x04e45aaf, not 0x414bf389. The two routers are
* therefore *not* interchangeable behind one interface, and calling the wrong
* one matches no function at all -- execution falls through to the fallback
* and reverts with empty returndata, which is indistinguishable from an
* out-of-gas at a glance.
*
* Both are live on this project's networks: Robinhood mainnet's Uniswap V3
* router is SwapRouter02, its testnet's is the original, and SushiSwap's is
* the original on both. Which one an adapter is talking to is therefore a
* deployment fact, not a compile-time one -- see UniswapV3Adapter's
* `routerIsSwapRouter02`.
*/
interface ISwapRouter02Minimal {
struct ExactInputSingleParams {
address tokenIn;
address tokenOut;
uint24 fee;
address recipient;
uint256 amountIn;
uint256 amountOutMinimum;
uint160 sqrtPriceLimitX96;
}
function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut);
}
Compiler settingsShow
{
"viaIR": true,
"metadata": {
"appendCBOR": true,
"bytecodeHash": "ipfs",
"useLiteralContent": false
},
"libraries": {},
"optimizer": {
"runs": 200,
"enabled": true
},
"evmVersion": "cancun",
"remappings": [
"@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
"forge-std/=lib/forge-std/src/",
"erc4626-tests/=/Users/narwastunagoro/Projects/rh-launchpad/.claude/worktrees/tax-audit-r3/contracts/lib/openzeppelin-contracts/lib/erc4626-tests/",
"halmos-cheatcodes/=/Users/narwastunagoro/Projects/rh-launchpad/.claude/worktrees/tax-audit-r3/contracts/lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
"openzeppelin-contracts/=/Users/narwastunagoro/Projects/rh-launchpad/.claude/worktrees/tax-audit-r3/contracts/lib/openzeppelin-contracts/contracts/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.