Verified contractExactMIT
PadToken
Address0xcf10abac747ed9f22e4fdcd62e30cd5eeb93956a
- Balance
0 ETH
- Transactions
67
- Compiler
solc 0.8.26
- Same code
1 more contract
Details
- Compiler
- solc 0.8.26+commit.8a97fa7a
- Language
- solidity
- Optimization
- Yes, 200 runs
- Via IR
- yes
- License
- MIT
- Match
- Exactcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 25,734,101
- Creation transaction
- 0x4effd7f0da…2ddc55870a
- Main copy (most transactions)
- 0xf4beb646…ea2dd90b
PrecisionPad.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.26;
/// ----------------------------------------------------------------------
/// PrecisionPad — a minimal launchpad on top of PrecisionPoolFactory.
///
/// * launch() deploys a fixed-supply ERC20, seeds a PrecisionPool with
/// 100% of the supply (tokens-only at the launch price), and keeps the
/// LP tokens locked in this contract forever. No rug path exists.
/// * The Pad is the pool's feeRecipient. Anyone can call claimFees();
/// accrued creator fees are split between the token creator and the
/// Pad treasury at an immutable ratio.
/// * An optional dev-buy: send ETH with launch() and the Pad buys the
/// fresh pool in the same transaction, tokens go to the creator.
/// * Each launch stores a logo URI + metadata for front-ends.
/// ----------------------------------------------------------------------
interface IPPF {
struct Market {
address token0;
address token1;
uint256 sqrtPLow;
uint256 sqrtPHigh;
uint256 fee;
address hook;
address feeRecipient;
uint256 creatorFeeBps;
}
function createAndSeed(
Market calldata m,
uint256 sqrtPriceInit,
uint256 amount0,
uint256 amount1,
uint256 minLP,
address to
) external payable returns (address pool, uint256 lp, uint256 used0, uint256 used1);
}
interface IPool {
function collectCreatorFees(address to) external returns (uint256 a0, uint256 a1);
function swapExactIn(address tokenIn, uint256 amountIn, uint256 minOut, address to)
external
payable
returns (uint256 amountOut);
}
interface IERC20 {
function approve(address, uint256) external returns (bool);
function transfer(address, uint256) external returns (bool);
function balanceOf(address) external view returns (uint256);
}
/// @notice Fixed-supply, 18-decimals ERC20. No owner, no mint, no tax.
contract PadToken {
string public name;
string public symbol;
uint8 public constant decimals = 18;
uint256 public totalSupply;
mapping(address => uint256) public balanceOf;
mapping(address => mapping(address => uint256)) public allowance;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
constructor(string memory _name, string memory _symbol, uint256 _supply) {
name = _name;
symbol = _symbol;
totalSupply = _supply;
balanceOf[msg.sender] = _supply;
emit Transfer(address(0), msg.sender, _supply);
}
function approve(address spender, uint256 value) external returns (bool) {
allowance[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
function transfer(address to, uint256 value) external returns (bool) {
return _transfer(msg.sender, to, value);
}
function transferFrom(address from, address to, uint256 value) external returns (bool) {
uint256 a = allowance[from][msg.sender];
if (a != type(uint256).max) {
require(a >= value, "allowance");
allowance[from][msg.sender] = a - value;
}
return _transfer(from, to, value);
}
function _transfer(address from, address to, uint256 value) internal returns (bool) {
require(balanceOf[from] >= value, "balance");
unchecked {
balanceOf[from] -= value;
balanceOf[to] += value;
}
emit Transfer(from, to, value);
return true;
}
}
contract PrecisionPad {
// --------------------------------------------------------------- config
/// @notice The PrecisionPoolFactory this pad launches on.
address public immutable factory;
/// @notice Treasury receiving the pad's share of creator fees.
address public immutable treasury;
/// @notice Pad share of collected creator fees, in bps of the claim.
uint256 public immutable padFeeBps;
uint256 internal constant BPS = 10_000;
uint256 internal constant MAX_PAD_FEE = 5_000; // pad can never take >50%
// --------------------------------------------------------------- state
struct Launch {
address token;
address pool;
address creator;
uint64 createdAt;
string logoURI;
}
Launch[] internal _launches;
mapping(address => uint256) internal _indexByToken; // index+1, 0 = none
mapping(address => uint256) internal _indexByPool; // index+1, 0 = none
// --------------------------------------------------------------- events
event Launched(
address indexed token,
address indexed pool,
address indexed creator,
uint256 supply,
uint256 lp,
string logoURI
);
event FeesClaimed(
address indexed pool,
address indexed creator,
uint256 creator0,
uint256 creator1,
uint256 pad0,
uint256 pad1
);
// --------------------------------------------------------------- errors
error BadParams();
error UnknownPool();
error EthTransferFailed();
constructor(address _factory, address _treasury, uint256 _padFeeBps) {
if (_factory == address(0) || _treasury == address(0) || _padFeeBps > MAX_PAD_FEE) revert BadParams();
factory = _factory;
treasury = _treasury;
padFeeBps = _padFeeBps;
}
/// @dev Accept native refunds from the factory and fee payouts from pools.
receive() external payable {}
// --------------------------------------------------------------- launch
/// @notice Deploy a token and open its market. 100% of supply is seeded;
/// LP stays locked in the Pad forever.
/// @param supply Total supply in wei units (18 decimals).
/// @param sqrtPLow Band floor sqrt price (sqrt(tokens-per-ETH) * 1e18).
/// @param sqrtPHigh Band top = launch sqrt price.
/// @param feePips Swap fee in pips (10_000 = 1%).
/// @param creatorFeeBps Creator fee share of the swap fee, <= 5_000.
/// @param minLP Slippage floor for the seed.
/// @param minDevBuyOut Slippage floor for the optional msg.value dev-buy.
/// @param logoURI http(s)/ipfs image for front-ends (can be empty).
function launch(
string calldata name,
string calldata symbol,
uint256 supply,
uint256 sqrtPLow,
uint256 sqrtPHigh,
uint256 feePips,
uint256 creatorFeeBps,
uint256 minLP,
uint256 minDevBuyOut,
string calldata logoURI
) external payable returns (address token, address pool, uint256 lp) {
if (supply == 0 || sqrtPLow == 0 || sqrtPLow >= sqrtPHigh) revert BadParams();
// 1. token — full supply minted to the Pad.
token = address(new PadToken(name, symbol, supply));
// 2. create + seed. Pad is feeRecipient, LP minted to the Pad.
IERC20(token).approve(factory, supply);
IPPF.Market memory m = IPPF.Market({
token0: address(0),
token1: token,
sqrtPLow: sqrtPLow,
sqrtPHigh: sqrtPHigh,
fee: feePips,
hook: address(0),
feeRecipient: address(this),
creatorFeeBps: creatorFeeBps
});
uint256 used1;
(pool,, , used1) = _create(m, sqrtPHigh, supply, minLP);
lp = IERC20(pool).balanceOf(address(this));
// 3. register.
_launches.push(
Launch({token: token, pool: pool, creator: msg.sender, createdAt: uint64(block.timestamp), logoURI: logoURI})
);
_indexByToken[token] = _launches.length;
_indexByPool[pool] = _launches.length;
// 4. optional dev-buy with msg.value; proceeds go to the creator.
if (msg.value != 0) {
IPool(pool).swapExactIn{value: msg.value}(address(0), msg.value, minDevBuyOut, msg.sender);
}
// 5. sweep any seed dust to the creator (tokens-only seeds normally use all).
if (used1 < supply) {
uint256 dust = IERC20(token).balanceOf(address(this));
if (dust != 0) IERC20(token).transfer(msg.sender, dust);
}
emit Launched(token, pool, msg.sender, supply, lp, logoURI);
}
/// @dev Split out to avoid stack-too-deep.
function _create(IPPF.Market memory m, uint256 sqrtInit, uint256 amount1, uint256 minLP)
internal
returns (address pool, uint256 lp, uint256 used0, uint256 used1)
{
(pool, lp, used0, used1) = IPPF(factory).createAndSeed(m, sqrtInit, 0, amount1, minLP, address(this));
}
// ----------------------------------------------------------------- fees
/// @notice Collect a pool's accrued creator fees and split them between
/// the token creator and the Pad treasury. Anyone may call.
function claimFees(address pool) external returns (uint256 a0, uint256 a1) {
uint256 idx = _indexByPool[pool];
if (idx == 0) revert UnknownPool();
address creator = _launches[idx - 1].creator;
(a0, a1) = IPool(pool).collectCreatorFees(address(this));
uint256 pad0 = (a0 * padFeeBps) / BPS;
uint256 pad1 = (a1 * padFeeBps) / BPS;
if (pad0 != 0) _payEth(treasury, pad0);
if (a0 - pad0 != 0) _payEth(creator, a0 - pad0);
address token = _launches[idx - 1].token;
if (pad1 != 0) IERC20(token).transfer(treasury, pad1);
if (a1 - pad1 != 0) IERC20(token).transfer(creator, a1 - pad1);
emit FeesClaimed(pool, creator, a0 - pad0, a1 - pad1, pad0, pad1);
}
function _payEth(address to, uint256 amount) internal {
(bool ok,) = to.call{value: amount}("");
if (!ok) revert EthTransferFailed();
}
// ------------------------------------------------------------ discovery
function launchCount() external view returns (uint256) {
return _launches.length;
}
function launchAt(uint256 i) external view returns (Launch memory) {
return _launches[i];
}
/// @notice Newest-last slice for front-ends.
function launchesSlice(uint256 start, uint256 count) external view returns (Launch[] memory out) {
uint256 n = _launches.length;
if (start >= n) return new Launch[](0);
uint256 end = start + count;
if (end > n) end = n;
out = new Launch[](end - start);
for (uint256 i = start; i < end; ++i) {
out[i - start] = _launches[i];
}
}
function launchForToken(address token) external view returns (Launch memory l) {
uint256 idx = _indexByToken[token];
if (idx != 0) l = _launches[idx - 1];
}
function launchForPool(address pool) external view returns (Launch memory l) {
uint256 idx = _indexByPool[pool];
if (idx != 0) l = _launches[idx - 1];
}
}
Compiler settingsShow
{
"viaIR": true,
"optimizer": {
"runs": 200,
"enabled": true
}
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.