Creating a Coin

This guide covers how to create coins directly using the Basememe Factory contract.

Basememe Factory contract creates Coins, setting up Bonding Curves and initialize Uniswap V3 pools. Each Coin is configured to have a Bonding Curve and a Liquidity pool setup with a coin pair of its backing currency on each chain.

There are 2 ways available for coin creation.

Create Coin

To create a new coin, you send a transaction to call the createBasememeToken method.

Method Interface

// solidity interface 

/// @notice Create a new token with required params
///
/// @param _name The name of the token
/// @param _symbol The symbol/ticker of the token
/// @param _tokenURI The IPFS URI of token metadata
/// @param _nonce Random number for salt generation
/// @param _signature The verify-able signature for token creation
/// @param _platformReferrer The Creator Referrer address to receive reward
/// @param _payoutRecipient The Creator address to receive reward
/// @param _tokenSalt Salt for deterministic CREATE2 deployment. Enables predictable token addresses.
///
/// @return token The address of the created token
function createBasememeToken(
    string memory _name,
    string memory _symbol,
    string memory _tokenURI,
    uint256 _nonce,
    bytes memory _signature,
    address _platformReferrer,
    address _payoutRecipient,
    bytes32 _tokenSalt
)
    external
    returns (address);

Events

The factory emit an event upon successful coin creation

/// @notice emitted when a new token is created
///
/// @param addr The token contract address
/// @param bondingCurve The Bonding Curve address of the token
/// @param creator The sender address of token creation
/// @param signature The signature used to create the token
/// @param platformReferrer The Creator Referrer address to receive reward
/// @param payoutReceipent The Creator address to receive reward
/// @param owner The owner address of token contract
/// @param nonce Random number for salt generation
/// @param name The name of the token
/// @param symbol The symbol/ticker of the token
/// @param tokenURI The IPFS URI of token metadata
/// @param version The BasememeToken version created
event NewBasememeToken(
    address addr,
    address bondingCurve,
    address creator, 
    bytes signature, 
    address platformReferrer, 
    address payoutRecipient, 
    address owner,
    uint256 nonce,
    string name,
    string symbol,
    string tokenURI,
    string version      
);

Create and Buy Coin

To create a new coin, you send a transaction to call the createBasememeTokenAndBuy method.

Method Interface

// solidity interface 

/// @notice Create a new token and buy upon creation with required params
///
/// @param _name The name of the token
/// @param _symbol The symbol/ticker of the token
/// @param _tokenURI The IPFS URI of token metadata
/// @param _nonce Random number for salt generation
/// @param _tokenAmountMin Min expected amount of token to receive
/// @param _signature The verify-able signature for token creation
/// @param _platformReferrer The Creator Referrer address to receive reward
/// @param _payoutRecipient The Creator address to receive reward
/// @param _tokenSalt Salt for deterministic CREATE2 deployment. Enables predictable token addresses.
///
/// @return token The address of the created token
function createBasememeTokenAndBuy(
    string memory _name,
    string memory _symbol,
    string memory _tokenURI,
    uint256 _nonce,
    uint256 _tokenAmountMin,
    bytes memory _signature,
    address _platformReferrer,
    address _payoutRecipient,
    bytes32 _tokenSalt
)
    external
    payable
    returns (address);

Events

The factory emit NewBasememeToken event upon successful coin creation

/// @notice emitted when a new token is created
///
/// @param addr The token contract address
/// @param bondingCurve The Bonding Curve address of the token
/// @param creator The sender address of token creation
/// @param signature The signature used to create the token
/// @param platformReferrer The Creator Referrer address to receive reward
/// @param payoutReceipent The Creator address to receive reward
/// @param owner The owner address of token contract
/// @param nonce Random number for salt generation
/// @param name The name of the token
/// @param symbol The symbol/ticker of the token
/// @param tokenURI The IPFS URI of token metadata
/// @param version The BasememeToken version created
event NewBasememeToken(
    address addr,
    address bondingCurve,
    address creator, 
    bytes signature, 
    address platformReferrer, 
    address payoutRecipient, 
    address owner,
    uint256 nonce,
    string name,
    string symbol,
    string tokenURI,
    string version      
);

Successful purchase of new coin create will emit Buy event

/// @notice emitted upon successful token purchase
///
/// @param buyer The token buyer address
/// @param token The purchased token address
/// @param tokenAmount The amount of token purhased
/// @param collateralAmount The amount of collateral, usually chain's native token, used to purchase token 
/// @param refund The amount of collateral refunded to buyer if there's leftover
/// @param tradeFee The amount of fee collected by platform for token purchase
/// @param curveProgressBps The updated Bonding Curve progress basis points for token
/// @param virtualCollateralReserves The updated virtual collateral reserves amount in Bonding Curve stage
/// @param virtualTokenReserves The updated virtual token reserves amount in Bonding Curve stage
/// @param collateralReserves The updated real collateral reserves amount in Bonding Curve stage
/// @param tokenReserves The updated real token reserves amount in Bonding Curve stage
event Buy(
    address indexed buyer,
    address indexed token,
    uint256 tokenAmount,
    uint256 collateralAmount,
    uint256 refund,
    uint256 tradeFee,
    uint256 curveProgressBps,
    uint256 virtualCollateralReserves,
    uint256 virtualTokenReserves,
    uint256 collateralReserves,
    uint256 tokenReserves
);

Additional Info

There're 2 params in both create token method that need extra attention:

  • _tokenURI : All the metadata about created coins are stored on IPFS. You need to upload your image and the meta of your token to IPFS following example below:

{
    name: "My Base Memecoin",
    description: "Base for everyone!",
    symbol: "MYBASECOIN",
    image: "ipfs://CID/base_coin.png",
    website: "https://example.com",
    x: "https://x.com/my_base_coin",
    telegram: "https://t.me/my_base_coin",
}
  • _signature : For the moment, there's no signature required to create a coin using Basememe Factory, pass in empty bytes value for _signature will do the job.

Last updated