Verified contractExactMIT
LaunchConfig
Address0x9fc8d41b2535e1636fe5cd1327b3b7e91f79d015
- Balance
0 ETH
- Transactions
11
- 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,064
- Creation transaction
- 0xf471472ada…4e96b34619
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);
}
}
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/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;
}
}
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.