> For the complete documentation index, see [llms.txt](https://docs.base.meme/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.base.meme/for-developers/trading-coins/factory-trade-helper.md).

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

```solidity
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

```solidity
function buyWithEth(address token, uint256 funds, uint256 minTokenOut, address tradeReferrer)
    external
    payable
    returns (uint256 tokenOut, uint256 refundOut);
```

* `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

```solidity
function sellForEth(address token, uint256 tokenAmountIn, uint256 minEthOut, address tradeReferrer)
    external
    returns (uint256 ethOut);
```

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