Verified contractExactMIT
DogePadToken
Address0x5fd8ea27ecaa59b8dea0920bbdc209da138c8c17
- Balance
0 ETH
- Transactions
39
- Compiler
solc 0.8.24
- Same code
1 more contract
Details
- Compiler
- solc 0.8.24+commit.e11b9ed9
- 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,624,966
- Creation transaction
- 0x0b2d836a77…338e15e698
DogePadFactory.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
/*
dogepad factory · ethereum mainnet
every pair is a doge pair
- fixed supply erc20, all supply into a one-sided uniswap v3 position
- pool is always TOKEN/DOGE, 1% fee tier
QUOTE ASSET IS 8 DECIMALS. bridged doge (doge.gay) uses 8 decimals, not 18.
the pool's raw price is token1/token0 in RAW units, so an 8-decimal quote
shifts the tick by log_1.0001(1e-10) = -230271 versus an 18-decimal one.
this contract makes no decimals assumption -- it takes startTick as given --
but every off-chain tick computation MUST account for it. see script/deploy.js.
- LP NFT IS MINTED TO lpRecipient, A WALLET -- NOT held by this factory.
it is an ordinary uniswap v3 position: whoever holds it can collect fees,
decrease liquidity, or withdraw the pool entirely. THIS PAD DOES NOT LOCK
LIQUIDITY. do not describe it as no-rug, and do not claim anywhere in the
frontend that the lp is locked or burned.
- starting tick passed by frontend to target ~$15k fdv at launch
scanner profile (gmgn / honeypot checkers):
- token has no owner, no mint, no tax, no blacklist, no pause, no proxy
- plain transfer path, honeypot sims pass
- liquidity WILL read as removable, because it is. that is the tradeoff for
making positions manageable from a wallet.
- verify factory + first token on etherscan; later tokens auto-match
deploy (remix, 0.8.24+, optimizer 200 runs):
constructor(lpRecipient)
e.g. (yourWallet) = every launch's lp nft lands in your wallet
*/
// ---------------------------------------------------------------- interfaces
interface IERC20 {
function transfer(address to, uint256 amt) external returns (bool);
function transferFrom(address from, address to, uint256 amt) external returns (bool);
function approve(address spender, uint256 amt) external returns (bool);
function balanceOf(address who) external view returns (uint256);
}
interface INonfungiblePositionManager {
struct MintParams {
address token0;
address token1;
uint24 fee;
int24 tickLower;
int24 tickUpper;
uint256 amount0Desired;
uint256 amount1Desired;
uint256 amount0Min;
uint256 amount1Min;
address recipient;
uint256 deadline;
}
struct CollectParams {
uint256 tokenId;
address recipient;
uint128 amount0Max;
uint128 amount1Max;
}
function createAndInitializePoolIfNecessary(
address token0, address token1, uint24 fee, uint160 sqrtPriceX96
) external payable returns (address pool);
function mint(MintParams calldata p) external payable
returns (uint256 tokenId, uint128 liquidity, uint256 amount0, uint256 amount1);
function collect(CollectParams calldata p) external payable
returns (uint256 amount0, uint256 amount1);
}
interface ISwapRouter {
struct ExactInputSingleParams {
address tokenIn;
address tokenOut;
uint24 fee;
address recipient;
uint256 deadline;
uint256 amountIn;
uint256 amountOutMinimum;
uint160 sqrtPriceLimitX96;
}
function exactInputSingle(ExactInputSingleParams calldata p)
external payable returns (uint256 amountOut);
}
// ---------------------------------------------------------------- tick math
library TickMath {
function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {
unchecked {
uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));
require(absTick <= 887272, "T");
uint256 ratio = absTick & 0x1 != 0
? 0xfffcb933bd6fad37aa2d162d1a594001
: 0x100000000000000000000000000000000;
if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;
if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;
if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;
if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;
if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;
if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;
if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;
if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;
if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;
if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;
if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;
if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;
if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;
if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;
if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;
if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;
if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;
if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;
if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;
if (tick > 0) ratio = type(uint256).max / ratio;
sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));
}
}
}
// ---------------------------------------------------------------- token
contract DogePadToken is IERC20 {
string public name;
string public symbol;
uint8 public constant decimals = 18;
uint256 public constant totalSupply = 1_000_000_000e18;
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) {
name = _name;
symbol = _symbol;
balanceOf[msg.sender] = totalSupply;
emit Transfer(address(0), msg.sender, totalSupply);
}
function transfer(address to, uint256 amt) external returns (bool) {
_transfer(msg.sender, to, amt);
return true;
}
function transferFrom(address from, address to, uint256 amt) external returns (bool) {
uint256 allowed = allowance[from][msg.sender];
if (allowed != type(uint256).max) {
require(allowed >= amt, "allowance");
allowance[from][msg.sender] = allowed - amt;
}
_transfer(from, to, amt);
return true;
}
function approve(address spender, uint256 amt) external returns (bool) {
allowance[msg.sender][spender] = amt;
emit Approval(msg.sender, spender, amt);
return true;
}
function _transfer(address from, address to, uint256 amt) internal {
require(balanceOf[from] >= amt, "balance");
unchecked {
balanceOf[from] -= amt;
balanceOf[to] += amt;
}
emit Transfer(from, to, amt);
}
}
// ---------------------------------------------------------------- factory
contract DogePadFactory {
// mainnet · bridged dogecoin (doge.gay bridge), 8 decimals
address public constant DOGE = 0x4206931337dc273a630d328dA6441786BfaD668f;
INonfungiblePositionManager public constant NPM =
INonfungiblePositionManager(0xC36442b4a4522E871399CD717aBDD847Ab11FE88);
ISwapRouter public constant ROUTER =
ISwapRouter(0xE592427A0AEce92De3Edee1F18E0157C05861564);
uint24 public constant FEE = 10000; // 1% tier
int24 public constant TICK_SPACING = 200;
int24 public constant MAX_ALIGNED = 887200;
uint256 public constant SUPPLY = 1_000_000_000e18;
struct Launch {
address creator;
uint256 lpTokenId;
address token0;
address token1;
}
address public owner;
/// @notice every launch's lp nft is minted straight to this address.
/// it is a normal uniswap v3 position owned by a wallet: the holder can
/// collect fees, decrease liquidity, or remove the pool entirely.
address public lpRecipient;
address[] public allTokens;
mapping(address => Launch) public launches;
event Launched(
address indexed token,
address indexed creator,
uint256 lpTokenId,
int24 startTick,
string name,
string symbol,
string imageUri,
string description
);
event LpRecipientSet(address lpRecipient);
event OwnerSet(address owner);
modifier onlyOwner() {
require(msg.sender == owner, "not owner");
_;
}
constructor(address _lpRecipient) {
require(_lpRecipient != address(0), "recipient");
owner = msg.sender;
lpRecipient = _lpRecipient;
}
/// @notice deploy a token and seed its one-sided DOGE pair on uniswap v3
/// @param startTick starting tick in TOKEN-as-token0 orientation (raw doge per token,
/// i.e. already scaled for doge's 8 decimals against the token's 18).
/// must be a multiple of 200. frontend computes it for ~$15k fdv.
/// flipped automatically if address ordering lands the other way.
/// @param dogeBuyAmount optional dev buy in DOGE (8 decimals), pulled from msg.sender (approve first)
function launch(
string calldata name_,
string calldata symbol_,
string calldata imageUri,
string calldata description,
int24 startTick,
uint256 dogeBuyAmount
) external returns (address token) {
require(startTick % TICK_SPACING == 0, "tick spacing");
require(startTick > -MAX_ALIGNED && startTick < MAX_ALIGNED, "tick range");
token = address(new DogePadToken(name_, symbol_));
uint256 lpTokenId = _seed(token, startTick);
allTokens.push(token);
emit Launched(token, msg.sender, lpTokenId, startTick, name_, symbol_, imageUri, description);
if (dogeBuyAmount > 0) _devBuy(token, dogeBuyAmount);
}
/// @dev create + init the pool, mint the one-sided position, record the launch
function _seed(address token, int24 startTick) internal returns (uint256 lpTokenId) {
IERC20(token).approve(address(NPM), SUPPLY);
bool tokenIs0 = token < DOGE;
address t0 = tokenIs0 ? token : DOGE;
address t1 = tokenIs0 ? DOGE : token;
int24 tick = tokenIs0 ? startTick : -startTick;
NPM.createAndInitializePoolIfNecessary(t0, t1, FEE, TickMath.getSqrtRatioAtTick(tick));
(lpTokenId,,,) = NPM.mint(
INonfungiblePositionManager.MintParams({
token0: t0,
token1: t1,
fee: FEE,
tickLower: tokenIs0 ? tick : -MAX_ALIGNED,
tickUpper: tokenIs0 ? MAX_ALIGNED : tick,
amount0Desired: tokenIs0 ? SUPPLY : 0,
amount1Desired: tokenIs0 ? 0 : SUPPLY,
amount0Min: 0,
amount1Min: 0,
recipient: lpRecipient,
deadline: block.timestamp
})
);
launches[token] = Launch({
creator: msg.sender,
lpTokenId: lpTokenId,
token0: t0,
token1: t1
});
}
/// @dev optional dev buy in the launch tx, before anyone else can snipe
function _devBuy(address token, uint256 dogeBuyAmount) internal {
IERC20(DOGE).transferFrom(msg.sender, address(this), dogeBuyAmount);
IERC20(DOGE).approve(address(ROUTER), dogeBuyAmount);
ROUTER.exactInputSingle(
ISwapRouter.ExactInputSingleParams({
tokenIn: DOGE,
tokenOut: token,
fee: FEE,
recipient: msg.sender,
deadline: block.timestamp,
amountIn: dogeBuyAmount,
amountOutMinimum: 0,
sqrtPriceLimitX96: 0
})
);
}
// no claimFees here on purpose. the lp nft is owned by lpRecipient, and the
// position manager only lets the nft's owner or an approved operator collect.
// a factory-side claim would always revert. collect fees from the wallet that
// holds the nft, on app.uniswap.org or directly against the position manager.
// ------------------------------------------------------------ views
function tokenCount() external view returns (uint256) {
return allTokens.length;
}
function tokensPage(uint256 start, uint256 n) external view returns (address[] memory out) {
uint256 len = allTokens.length;
if (start >= len) return new address[](0);
uint256 end = start + n > len ? len : start + n;
out = new address[](end - start);
for (uint256 i = start; i < end; i++) out[i - start] = allTokens[i];
}
// ------------------------------------------------------------ admin
/// @notice change where future launches send their lp nft.
/// does not move nfts already minted.
function setLpRecipient(address _lpRecipient) external onlyOwner {
require(_lpRecipient != address(0), "recipient");
lpRecipient = _lpRecipient;
emit LpRecipientSet(_lpRecipient);
}
function setOwner(address _owner) external onlyOwner {
owner = _owner;
emit OwnerSet(_owner);
}
function onERC721Received(address, address, uint256, bytes calldata)
external pure returns (bytes4)
{
return this.onERC721Received.selector;
}
}
Compiler settingsShow
{
"viaIR": true,
"optimizer": {
"runs": 200,
"enabled": true
}
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.