Factory Trade Helper (ETH In / ETH Out)

This guide covers Bonding Curve stage trading through the Basememe Factory Trade Helper contract.

Coins on Base.meme can be created with different collateral pairs (ETH / USDC / SOL). For coins that use an ERC20 collateral token (e.g. USDC / SOL), interacting with the Factory directly requires the caller to hold and approve that collateral token.

The Trade Helper provides a simplified interface that lets callers trade using ETH only:

  • Buy: pay in ETH, receive the coin

  • Sell: pay in the coin, receive ETH

Internally, the helper swaps between ETH and the coin’s configured collateral token, then calls the Factory.

Quote Methods

These methods return the coin’s configured collateral token and an estimated conversion amount between ETH and that collateral token.

function quoteEthToCollateralForToken(address token, uint256 ethIn)
    external
    returns (address collateralToken, uint256 collateralOut);

function quoteCollateralToEthForToken(address token, uint256 collateralIn)
    external
    returns (address collateralToken, uint256 ethOut);

Trading Methods

Buy with ETH

  • funds must match msg.value.

  • refundOut is any leftover ETH refunded back to the caller (e.g. due to fee/price movement or swap output variance).

Sell for ETH

The caller must approve the helper to transfer tokenAmountIn of the coin before selling.

Last updated