Build
Launch from a script
The launch call, its parameters and the events it emits.
A launch is one call from any wallet. The interface is optional: this is the same call the launch form makes.
The call
function launch(LaunchParams calldata p) external payable returns (address token, uint256 tokenId);
struct LaunchParams {
string name;
string symbol;
string metadataURI;
address quote; // address(0) = the chain's native asset, else any ERC-20
uint256 supply; // 0 = 1,000,000,000e18
int24 startTick; // a multiple of 200
bool creatorPayout; // false = Foundation (foundation 1%, creator 0.5%), true = Creator payout (creator 1%, foundation 0.5%)
bytes32 salt; // scoped to msg.sender
}Send at least creationFee() as msg.value. The factory forwards the fee to the foundation and refunds anything above it.
cast send $FACTORY \
"launch((string,string,string,address,uint256,int24,bool,bytes32))" \
"(My Token,MYT,,0x0000000000000000000000000000000000000000,0,184200,false,0x$(openssl rand -hex 32))" \
--value 0.0006ether --rpc-url $RPC --private-key $PKParameters
| Parameter | Notes |
|---|---|
quote | Zero address for the native asset. For any ERC-20, call findSalt(...) first so the token's address sorts above the quote. |
supply | 0 means the default 1B. |
startTick | Sets the opening price: 184200 is 1 ETH for 100M tokens (10 ETH at 1B supply). Must be a multiple of 200. |
creatorPayout | Where the trading fee goes. Fixed forever. |
salt | Any 32 bytes, scoped to the caller. Reusing a salt with the same terms reverts with SaltUsed. |
Helpers
creationFee(): the launch fee in wei.findSalt(launcher, baseSalt, name, symbol, supply, metadataURI, quote, maxTries): a salt whose token address sorts abovequote.predictToken(launcher, salt, name, symbol, supply, metadataURI): the address a launch would create.poolKeyOf(token),infoOf(token)andsplitOf(creatorPayout): read a launch back.
The event
event Launched(
address indexed token,
uint256 indexed tokenId,
address indexed launcher,
address quote,
bytes32 poolId,
int24 startTick,
uint24 lpFee, // the pool fee, fixed
bool creatorPayout,
uint256 creationFee,
uint256 supply,
string metadataURI
);Errors
| Error | Meaning |
|---|---|
InsufficientCreationFee(required, sent) | msg.value was below the launch fee. |
SaltUsed | That token address already exists. Use a new salt. |
QuoteOrdering | The token's address does not sort above the quote. Use findSalt. |
BadTick, BadSupply, NoLiquidity | The start tick or supply cannot make a valid position. |
TransferFailed | The launch fee could not be sent to the foundation wallet. |
Optional metadata
For an image, a description or links, register metadata first. The response contains the uri to pass as metadataURI and the predicted token address. See the API.