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

# Bonding Curve Stage Trading

This guide covers Bonding Curve stage trading through the **RH Factory** contract.

Trading behavior depends on the coin's collateral type:

* Native collateral: `tokenToCollateralToken(token) == address(0)`
* ERC20 collateral: `tokenToCollateralToken(token) != address(0)`

## Buy Coins with Exact Collateral Value

Use `buyExactInWithCollateral` for multi-collateral exact-in buys.

```solidity
function buyExactInWithCollateral(
    address _token,
    uint256 _collateralAmountIn,
    uint256 _amountOutMin
)
    external
    payable;
```

Payment notes:

* Native collateral: `msg.value == _collateralAmountIn`
* ERC20 collateral: `msg.value == 0`, and caller approves `_collateralAmountIn`

***

## Buy Coins with Exact Collateral Value (Native-only Legacy Entry)

`buyExactIn` is the legacy native-collateral exact-in entrypoint.

```solidity
function buyExactIn(
    address _token,
    uint256 _amountOutMin
)
    external
    payable;
```

For ERC20-collateral markets, use `buyExactInWithCollateral`.

***

## Buy Exact Coin Amount

Use `buyExactOut` for exact-out buys.

```solidity
function buyExactOut(
    address _token,
    uint256 _tokenAmount,
    uint256 _maxCollateralAmount
)
    external
    payable;
```

***

## Sell Exact Coin Amount

Use `sellExactIn` for exact-in sells.

```solidity
function sellExactIn(
    address _token,
    uint256 _tokenAmount,
    uint256 _amountCollateralMin
)
    external;
```

***

## Sell Coins for Exact Collateral Value

Use `sellExactOut` for exact-out sells.

```solidity
function sellExactOut(
    address _token,
    uint256 _tokenAmountMax,
    uint256 _amountCollateral
)
    external;
```

***

## Related Events

Successful trades emit:

* `Buy`
* `Sell`

For routed calls (trusted caller flows), recipient tracking events may also be emitted:

* `BuyRecipient`
* `SellRecipient`

See ABI for complete event fields.
