Factory
The Factory
contract contains functions to create, buy, sell and launch tokens. This is the main entrypoint of the protocol; creators and traders will mostly interact with this contract.
The user flow of the protocol is:
Creator calls
createToken()
to launch a new token.Traders call
buyTokens()
andsellTokens()
to trade the token.A sufficient amount of tokens is sold and the bonding curve is fulfilled.
Anyone calls
launchToken()
to launch the token to Uniswap V2.
Public Functions
createToken
Create a new token with a name
, symbol
, metadata
and a unique salt
.
Must be called with an amount of ETH equal to or greater than the creation fee; any excess ETH will be used to buy an initial amount of tokens for the creator.
Note that the new token is non-transferable and can only be traded through this contract.
function createToken(string memory name, string memory symbol, string memory metadata, bytes32 salt)
external
payable
returns (address tokenAddress, uint256 amountOut)
buyTokens
Buy tokens in exchange for ETH. Reverts if the amount of tokens received for the ETH provided is less than minAmountOut
.
function buyTokens(address token, uint256 minAmountOut) external payable returns (uint256 amountOut)
sellTokens
Sell amountIn
of tokens in exchange for ETH. Reverts if the amount of ETH received is less than minAmountOut
.
function sellTokens(address token, uint256 amountIn, uint256 minAmountOut) external returns (uint256 amountOut)
launchToken
Launch a token to Uniswap V2. Can only be called when the bonding curve is fulfilled.
Note that the token also becomes transferable post-launch.
function launchToken(address token) external returns (address uniswapV2Pair)
Last updated