Verified contractPartialMIT
GweiDotFun
Address0x6b3bc03da3d81c0edcbc904ac8396c0cb27421ef
- Balance
0 ETH
- Transactions
8
- Compiler
solc 0.8.26
- Same code
Only this contract
Details
- Compiler
- solc 0.8.26+commit.8a97fa7a
- Language
- solidity
- Optimization
- Yes, 200 runs
- EVM version
- cancun
- License
- MIT
- Match
- Partialcreation code: yes, runtime code: yes
- Verified on Sourcify
- Created in block
- 26,443,856
- Creation transaction
- 0x48964ff959…020b324d9a
86 files
The source code is large: one file is shown at a time. Choose a file in the list.
- src/platform/GweiDotFun.solmain11.91 KB
- node_modules/@openzeppelin/contracts/access/Ownable.sol3.1 KB
- node_modules/@openzeppelin/contracts/access/Ownable2Step.sol2.48 KB
- node_modules/@openzeppelin/contracts/governance/utils/IVotes.sol2.32 KB
- node_modules/@openzeppelin/contracts/governance/utils/Votes.sol9.67 KB
- node_modules/@openzeppelin/contracts/interfaces/IERC1363.sol4.45 KB
- node_modules/@openzeppelin/contracts/interfaces/IERC165.sol192 B
- node_modules/@openzeppelin/contracts/interfaces/IERC20.sol181 B
- node_modules/@openzeppelin/contracts/interfaces/IERC5267.sol739 B
- node_modules/@openzeppelin/contracts/interfaces/IERC5805.sol272 B
- node_modules/@openzeppelin/contracts/interfaces/IERC6372.sol519 B
- node_modules/@openzeppelin/contracts/interfaces/draft-IERC6093.sol6.54 KB
- node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol10.9 KB
- node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol2.78 KB
- node_modules/@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol1.18 KB
- node_modules/@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol2.77 KB
- node_modules/@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol3.61 KB
- node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol684 B
- node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol3.81 KB
- node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol9.44 KB
- node_modules/@openzeppelin/contracts/token/ERC721/IERC721.sol4.93 KB
- node_modules/@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol997 B
- node_modules/@openzeppelin/contracts/utils/Address.sol6.03 KB
- node_modules/@openzeppelin/contracts/utils/Context.sol963 B
- node_modules/@openzeppelin/contracts/utils/Errors.sol896 B
- node_modules/@openzeppelin/contracts/utils/Nonces.sol1.49 KB
- node_modules/@openzeppelin/contracts/utils/Panic.sol1.97 KB
- node_modules/@openzeppelin/contracts/utils/ReentrancyGuard.sol3.38 KB
- node_modules/@openzeppelin/contracts/utils/ShortStrings.sol4.28 KB
- node_modules/@openzeppelin/contracts/utils/StorageSlot.sol4.18 KB
- node_modules/@openzeppelin/contracts/utils/Strings.sol3.93 KB
- node_modules/@openzeppelin/contracts/utils/cryptography/ECDSA.sol7.82 KB
- node_modules/@openzeppelin/contracts/utils/cryptography/EIP712.sol6.61 KB
- node_modules/@openzeppelin/contracts/utils/cryptography/MessageHashUtils.sol3.7 KB
- node_modules/@openzeppelin/contracts/utils/introspection/IERC165.sol870 B
- node_modules/@openzeppelin/contracts/utils/math/Math.sol28.31 KB
- node_modules/@openzeppelin/contracts/utils/math/SafeCast.sol34.94 KB
- node_modules/@openzeppelin/contracts/utils/math/SignedMath.sol2.61 KB
- node_modules/@openzeppelin/contracts/utils/structs/Checkpoints.sol21.43 KB
- node_modules/@openzeppelin/contracts/utils/types/Time.sol5.16 KB
- node_modules/@uniswap/v4-periphery/lib/permit2/src/interfaces/IAllowanceTransfer.sol7.7 KB
- node_modules/@uniswap/v4-periphery/lib/permit2/src/interfaces/IEIP712.sol144 B
- node_modules/@uniswap/v4-periphery/lib/v4-core/src/interfaces/IExtsload.sol1.02 KB
- node_modules/@uniswap/v4-periphery/lib/v4-core/src/interfaces/IExttload.sol699 B
- node_modules/@uniswap/v4-periphery/lib/v4-core/src/interfaces/IHooks.sol8.23 KB
- node_modules/@uniswap/v4-periphery/lib/v4-core/src/interfaces/IPoolManager.sol12.84 KB
- node_modules/@uniswap/v4-periphery/lib/v4-core/src/interfaces/IProtocolFees.sol2.49 KB
- node_modules/@uniswap/v4-periphery/lib/v4-core/src/interfaces/external/IERC20Minimal.sol3.04 KB
- node_modules/@uniswap/v4-periphery/lib/v4-core/src/interfaces/external/IERC6909Claims.sol3.16 KB
- node_modules/@uniswap/v4-periphery/lib/v4-core/src/libraries/BitMath.sol2.61 KB
- node_modules/@uniswap/v4-periphery/lib/v4-core/src/libraries/CustomRevert.sol5.17 KB
- node_modules/@uniswap/v4-periphery/lib/v4-core/src/libraries/FixedPoint96.sol366 B
- node_modules/@uniswap/v4-periphery/lib/v4-core/src/libraries/FullMath.sol5.46 KB
- node_modules/@uniswap/v4-periphery/lib/v4-core/src/libraries/SafeCast.sol2.27 KB
- node_modules/@uniswap/v4-periphery/lib/v4-core/src/libraries/SqrtPriceMath.sol14.08 KB
- node_modules/@uniswap/v4-periphery/lib/v4-core/src/libraries/TickMath.sol12.38 KB
- node_modules/@uniswap/v4-periphery/lib/v4-core/src/libraries/UnsafeMath.sol1.17 KB
- node_modules/@uniswap/v4-periphery/lib/v4-core/src/types/BalanceDelta.sol2.34 KB
- node_modules/@uniswap/v4-periphery/lib/v4-core/src/types/BeforeSwapDelta.sol1.47 KB
- node_modules/@uniswap/v4-periphery/lib/v4-core/src/types/Currency.sol5.46 KB
- node_modules/@uniswap/v4-periphery/lib/v4-core/src/types/PoolId.sol539 B
- node_modules/@uniswap/v4-periphery/lib/v4-core/src/types/PoolKey.sol805 B
- node_modules/@uniswap/v4-periphery/lib/v4-core/src/types/PoolOperation.sol907 B
- node_modules/@uniswap/v4-periphery/src/interfaces/IEIP712_v4.sol328 B
- node_modules/@uniswap/v4-periphery/src/interfaces/IERC721Permit_v4.sol2.14 KB
- node_modules/@uniswap/v4-periphery/src/interfaces/IImmutableState.sol365 B
- node_modules/@uniswap/v4-periphery/src/interfaces/IMulticall_v4.sol774 B
- node_modules/@uniswap/v4-periphery/src/interfaces/INotifier.sol3.2 KB
- node_modules/@uniswap/v4-periphery/src/interfaces/IPermit2Forwarder.sol1.44 KB
- node_modules/@uniswap/v4-periphery/src/interfaces/IPoolInitializer_v4.sol782 B
- node_modules/@uniswap/v4-periphery/src/interfaces/IPositionManager.sol3.5 KB
- node_modules/@uniswap/v4-periphery/src/interfaces/ISubscriber.sol2.27 KB
- node_modules/@uniswap/v4-periphery/src/interfaces/IUnorderedNonce.sol799 B
- node_modules/@uniswap/v4-periphery/src/libraries/Actions.sol2.03 KB
- node_modules/@uniswap/v4-periphery/src/libraries/LiquidityAmounts.sol3.77 KB
- node_modules/@uniswap/v4-periphery/src/libraries/PositionInfoLibrary.sol3.95 KB
- src/platform/GweiFunPoolSeeder.sol13.6 KB
- src/platform/initializer/PoolKeyBuilder.sol6.16 KB
- src/platform/initializer/SingleSidedMinter.sol10.15 KB
- src/platform/token/OneTimeMint.sol5.31 KB
- src/platform/token/TimestampVoteClock.sol5.4 KB
- src/shared/GweiCreatorTag.sol4.87 KB
- src/shared/GweiFunPriceMath.sol10.06 KB
- src/shared/GweiFunVersion.sol4.92 KB
- src/shared/IGweiFunFeeHook.sol7.17 KB
- src/shared/IGweiFunLaunchpad.sol8.51 KB
src/platform/GweiDotFun.sol
// SPDX-License-Identifier: MIT
/*
╔═══════════════════════════════════════════════════════════════════════════════════════╗
║ ▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚ ║
║ ▞ ▚ ║
║ ▞ ┌─[ SYS ]──────────────────────────────────────────────────────────[ v4 ]─┐ ▚ ║
║ ▞ │ ◉ ONLINE ◎ UNISWAP v4 ◎ ETHEREUM MAINNET ◎ PERMISSIONLESS LAUNCH │ ▚ ║
║ ▞ └─────────────────────────────────────────────────────────────────────────┘ ▚ ║
║ ▞ ▚ ║
║ ▞ ▄████████▄ ██ ██ ████████ ██ ████████ ██ ██ ███ ██ ▚ ║
║ ▞ ██▀▀▀▀▀▀▀▀ ██ ▄▄ ██ ██▀▀▀▀▀▀ ██ ██▀▀▀▀▀▀ ██ ██ ████▄ ██ ▚ ║
║ ▞ ██ ▄████▄ ██ ████ ██ ██████ ██ ██████ ██ ██ ██ ▀██▄██ ▚ ║
║ ▞ ██ ▀▀▀▀██ ██▀█▀▀█▀██ ██▄▄▄▄▄▄ ██ ▄▄ ██ ▀██▄▄██▀ ██ ▀███ ▚ ║
║ ▞ ▀████████▀ ▀██▀ ▀██▀ ████████ ██ ▀▀ ██ ▀████▀ ██ ▀██ ▚ ║
║ ▞ ▚ ║
║ ▞ ╭─────────────────────────────────────────────────────────────────────────╮ ▚ ║
║ ▞ │ ░▒▓█▓▒░ T O K E N L A U N C H P A D · H O O K P O W E R E D │ ▚ ║
║ ▞ ╰─────────────────────────────────────────────────────────────────────────╯ ▚ ║
║ ▞ ▚ ║
║ ▞ ┌──────────────────────────────────┐ ┌──────────────────────────────────┐ ▚ ║
║ ▞ │ ◈ https://gwei.fun/ │ │ ✕ https://x.com/gweidotfun │ ▚ ║
║ ▞ └──────────────────────────────────┘ └──────────────────────────────────┘ ▚ ║
║ ▞ ▚ ║
║ ▞ ·──·──·──·──·──·──·──·──·──·──·──·──·──·──·──·──·──·──·──·──·──·──·──·──·──· ▚ ║
║ ▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚▚ ║
╚═══════════════════════════════════════════════════════════════════════════════════════╝
*/
pragma solidity 0.8.26;
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import {ERC20Permit} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol";
import {ERC20Burnable} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import {ERC20Votes} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Votes.sol";
import {Nonces} from "@openzeppelin/contracts/utils/Nonces.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import {GweiFunVersion} from "../shared/GweiFunVersion.sol";
import {OneTimeMint} from "./token/OneTimeMint.sol";
import {TimestampVoteClock} from "./token/TimestampVoteClock.sol";
import {GweiFunPoolSeeder, InitArgs} from "./GweiFunPoolSeeder.sol";
/// @title GweiDotFun
/// @notice The platform's own ERC-20, "GweiDotFun" (GWEI): fixed supply, permit, burnable, vote
/// checkpoints, and a one-shot {launch} that puts the ENTIRE supply into a locked
/// single-sided Uniswap v4 position and opens trading in that same transaction.
/// @dev Minted once in the constructor to {genesisHolder}. Until {launch} runs no token can move;
/// {launch} is callable once, by the genesis holder only, and requires that holder to still
/// own 100% of the supply, so nothing is ever held back from the pool. There is no owner,
/// mint, pause, blocklist, transfer levy or holding cap, and the trading gate is one-way.
/// Vote support is there so the token can take over governance later without migrating.
/// @custom:version 1.1
contract GweiDotFun is
ERC20Permit,
ERC20Burnable,
OneTimeMint,
TimestampVoteClock,
ReentrancyGuard,
GweiFunVersion
{
/// @dev A transfer was attempted before {launch}.
error TradingClosed();
/// @dev {launch} has already run.
error AlreadyLaunched();
/// @dev Only the genesis holder may launch.
error NotGenesisHolder();
/// @dev The genesis holder no longer owns the whole supply, so 100% cannot go into the pool.
error SupplyNotWhole();
/// @notice Trading went live. Fires exactly once, inside {launch}.
event TradingOpened(uint256 blockNumber, uint256 timestamp);
/// @notice The whole supply was placed as liquidity and the position handed to the locker.
event Launched(
address indexed seeder,
address indexed locker,
uint256 positionId,
uint160 sqrtPriceX96,
uint256 poolAmount,
uint256 dustBurned
);
/// @notice Supply minted at deployment, before any burn. Constructor argument, for verifiers.
uint256 public immutable genesisSupply;
/// @notice Whether trading is live. Never goes back to false.
bool public tradingEnabled;
/// @notice Timestamp at which trading went live (0 before).
uint64 public tradingEnabledAt;
/// @notice Block at which trading went live (0 before).
uint256 public tradingEnabledBlock;
/// @notice Locker that holds the liquidity position NFT (zero before launch).
address public lpLocker;
/// @notice Id of the liquidity position NFT (0 before launch).
uint256 public lpPositionId;
/// @param holder Gets the full supply and is the only account allowed to call {launch}.
/// @param supply Total supply in base units (18 decimals). Nothing is ever minted again.
constructor(address holder, uint256 supply)
ERC20("GweiDotFun", "GWEI")
ERC20Permit("GweiDotFun")
OneTimeMint(holder, supply)
{
genesisSupply = supply;
}
// ---------------------------------------------------------------------- launch
/// @notice Puts 100% of the supply into a single-sided v4 position, hands the position NFT
/// to `locker` (whose receiver hook starts its timelock) and opens trading. One call,
/// one transaction, callable once.
/// @dev The seeder pulls the tokens from this contract, stores the hook terms, initialises
/// the pool, mints the position and safe-transfers it to `locker`. Rounding dust the
/// seeder hands back is burned, so after this call every remaining token is in the pool.
/// @param seeder The GweiFunPoolSeeder; it must allow this token as a caller.
/// @param locker Final holder of the position NFT (GweiFunLpLocker).
/// @param payee Where the creator share of the pool's protocol fee accrues (the treasury).
/// @param openingCap Fully-diluted cap at open, in wei of ETH.
/// @param tickSpacing Tick spacing of the pool.
function launch(GweiFunPoolSeeder seeder, address locker, address payee, uint256 openingCap, int24 tickSpacing)
external
nonReentrant
returns (uint256 positionId, uint160 sqrtPriceX96)
{
if (tradingEnabled) revert AlreadyLaunched();
if (msg.sender != genesisHolder) revert NotGenesisHolder();
if (address(seeder) == address(0) || locker == address(0) || payee == address(0)) revert NullAddress();
uint256 supply = totalSupply();
if (balanceOf(msg.sender) != supply) revert SupplyNotWhole();
// Flipped first so the transfers below pass the gate. Everything up to the end of this
// call is one atomic transaction, and the pool holds no liquidity until the mint inside
// seedPool, so nobody can trade before the position exists.
tradingEnabled = true;
tradingEnabledAt = uint64(block.timestamp);
tradingEnabledBlock = block.number;
emit TradingOpened(block.number, block.timestamp);
_transfer(msg.sender, address(this), supply);
_approve(address(this), address(seeder), supply);
(, positionId, sqrtPriceX96) = seeder.seedPool(
InitArgs({
token: address(this),
pairAsset: address(0),
supply: supply,
poolAmount: supply,
openingCap: openingCap,
tickSpacing: tickSpacing,
positionHolder: locker,
creator: msg.sender,
payee: payee,
buyLevyBips: 0,
sellLevyBips: 0,
openingLevyBips: 0,
openingLevySecs: 0
})
);
_approve(address(this), address(seeder), 0);
// Whatever the liquidity solver could not fit is burned rather than kept anywhere.
uint256 dust = balanceOf(address(this));
if (dust != 0) _burn(address(this), dust);
lpLocker = locker;
lpPositionId = positionId;
emit Launched(address(seeder), locker, positionId, sqrtPriceX96, supply - dust, dust);
}
// ------------------------------------------------------------------- overrides
/// @dev Permit and vote delegation share one nonce sequence.
function nonces(address account) public view override(ERC20Permit, Nonces) returns (uint256) {
return super.nonces(account);
}
/// @dev Balance change plus vote checkpointing. Before {launch} nothing but the genesis mint
/// may move; afterwards no restriction is layered on top.
function _update(address from, address to, uint256 value) internal override(ERC20, ERC20Votes) {
if (from != address(0) && !tradingEnabled) revert TradingClosed();
super._update(from, to, value);
}
}
Compiler settingsShow
{
"viaIR": false,
"metadata": {
"appendCBOR": true,
"bytecodeHash": "none",
"useLiteralContent": false
},
"optimizer": {
"runs": 200,
"enabled": true
},
"evmVersion": "cancun",
"remappings": [
"@uniswap/v4-core/=node_modules/@uniswap/v4-periphery/lib/v4-core/",
"@uniswap/v4-periphery/=node_modules/@uniswap/v4-periphery/",
"v4-core/=node_modules/@uniswap/v4-periphery/lib/v4-core/",
"v4-periphery/=node_modules/@uniswap/v4-periphery/",
"permit2/=node_modules/@uniswap/v4-periphery/lib/permit2/",
"solmate/=node_modules/@uniswap/v4-periphery/lib/v4-core/lib/solmate/",
"forge-std/=node_modules/@uniswap/v4-periphery/lib/v4-core/lib/forge-std/src/",
"ds-test/=node_modules/@uniswap/v4-periphery/lib/v4-core/lib/forge-std/lib/ds-test/src/",
"openzeppelin-contracts/contracts/=node_modules/@openzeppelin/contracts/",
"@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/",
"node_modules/@uniswap/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/:erc4626-tests/=node_modules/@uniswap/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/lib/erc4626-tests/",
"/Users/steve/Documents/gweifun/node_modules/@uniswap/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/:erc4626-tests/=node_modules/@uniswap/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/lib/erc4626-tests/",
"node_modules/@uniswap/v4-core/lib/openzeppelin-contracts/:erc4626-tests/=node_modules/@uniswap/v4-core/lib/openzeppelin-contracts/lib/erc4626-tests/",
"/Users/steve/Documents/gweifun/node_modules/@uniswap/v4-core/lib/openzeppelin-contracts/:erc4626-tests/=node_modules/@uniswap/v4-core/lib/openzeppelin-contracts/lib/erc4626-tests/",
"node_modules/@uniswap/v4-periphery/lib/permit2/:openzeppelin-contracts/contracts/=node_modules/@openzeppelin/contracts/",
"/Users/steve/Documents/gweifun/node_modules/@uniswap/v4-periphery/lib/permit2/:openzeppelin-contracts/contracts/=node_modules/@openzeppelin/contracts/",
"node_modules/@uniswap/v4-periphery/lib/permit2/:openzeppelin-contracts/=node_modules/@uniswap/v4-periphery/lib/permit2/lib/openzeppelin-contracts/",
"/Users/steve/Documents/gweifun/node_modules/@uniswap/v4-periphery/lib/permit2/:openzeppelin-contracts/=node_modules/@uniswap/v4-periphery/lib/permit2/lib/openzeppelin-contracts/",
"node_modules/@uniswap/v4-periphery/lib/v4-core/:openzeppelin-contracts/contracts/=node_modules/@openzeppelin/contracts/",
"/Users/steve/Documents/gweifun/node_modules/@uniswap/v4-periphery/lib/v4-core/:openzeppelin-contracts/contracts/=node_modules/@openzeppelin/contracts/",
"node_modules/@uniswap/v4-periphery/lib/v4-core/:openzeppelin-contracts/=node_modules/@uniswap/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/",
"/Users/steve/Documents/gweifun/node_modules/@uniswap/v4-periphery/lib/v4-core/:openzeppelin-contracts/=node_modules/@uniswap/v4-periphery/lib/v4-core/lib/openzeppelin-contracts/",
"node_modules/@uniswap/v4-core/:openzeppelin-contracts/contracts/=node_modules/@openzeppelin/contracts/",
"/Users/steve/Documents/gweifun/node_modules/@uniswap/v4-core/:openzeppelin-contracts/contracts/=node_modules/@openzeppelin/contracts/",
"node_modules/@uniswap/v4-core/:openzeppelin-contracts/=node_modules/@uniswap/v4-core/lib/openzeppelin-contracts/",
"/Users/steve/Documents/gweifun/node_modules/@uniswap/v4-core/:openzeppelin-contracts/=node_modules/@uniswap/v4-core/lib/openzeppelin-contracts/",
"@openzeppelin/=node_modules/@openzeppelin/",
"@uniswap/=node_modules/@uniswap/",
"erc4626-tests/=node_modules/@uniswap/v4-core/lib/openzeppelin-contracts/lib/erc4626-tests/",
"forge-gas-snapshot/=node_modules/@uniswap/v4-periphery/lib/permit2/lib/forge-gas-snapshot/",
"openzeppelin-contracts/=node_modules/@uniswap/v4-core/lib/openzeppelin-contracts/"
]
}Source code and metadata: Sourcify.
The source code belongs to the authors of the contract.