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

SpaceLaunchFactorysolidity
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.

Launch with castshell
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 $PK

Parameters

ParameterNotes
quoteZero address for the native asset. For any ERC-20, call findSalt(...) first so the token's address sorts above the quote.
supply0 means the default 1B.
startTickSets the opening price: 184200 is 1 ETH for 100M tokens (10 ETH at 1B supply). Must be a multiple of 200.
creatorPayoutWhere the trading fee goes. Fixed forever.
saltAny 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 above quote.
  • predictToken(launcher, salt, name, symbol, supply, metadataURI): the address a launch would create.
  • poolKeyOf(token), infoOf(token) and splitOf(creatorPayout): read a launch back.

The event

Launchedsolidity
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

ErrorMeaning
InsufficientCreationFee(required, sent)msg.value was below the launch fee.
SaltUsedThat token address already exists. Use a new salt.
QuoteOrderingThe token's address does not sort above the quote. Use findSalt.
BadTick, BadSupply, NoLiquidityThe start tick or supply cannot make a valid position.
TransferFailedThe 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.