# Trading Mechanics

Before diving into trading mechanics, note that any HYPE sent by token creators during token creation automatically purchases tokens for the creator, ensuring fair launch conditions.

## Buying Tokens

Purchase tokens by sending HYPE to the contract:

```solidity
function buyTokens(address token) external payable
```

### How to Buy

1. **Send HYPE**: Include HYPE value in your transaction
2. **Automatic Calculation**: Contract calculates tokens based on bonding curve
3. **Fee Deduction**: 1% fee (split 50/50 between creator and protocol)
4. **Token Transfer**: Remaining tokens sent to your wallet

## Selling Tokens

Sell tokens back to the bonding curve:

```solidity
function sellTokens(address token, uint256 tokenAmount) external
```

### How to Sell

1. **Call sellTokens**: Specify how many tokens to sell
2. **Receive HYPE**: Get HYPE minus 1% fee back to your wallet

## Price Estimation

Before trading, estimate the outcome of your trade:

### Estimate Token Purchase

```solidity
function estimateBuy(address token, uint256 hypeAmount) public view returns (uint256)
```

### Estimate HYPE from Sale

```solidity
function estimateSell(address token, uint256 tokenAmount) public view returns (uint256)
```

## Bonding Curve Mechanics

### Price Formula

The bonding curve uses an AMM (Automated Market Maker) formula:

* **Virtual Reserves**: Each token starts with 300 HYPE and 1B tokens
* **Price Discovery**: Price = HYPE Reserve / Token Reserve
* **Dynamic Pricing**: Price increases as tokens are bought, decreases as tokens are sold

## Trading Fees

* **Fee Rate**: 1% on all trades (50% creator, 50% protocol)

## Trading Restrictions

### Creator Restrictions

* **1-hour lock**: Token creators cannot sell for 1 hour after creation
* Prevents immediate dumping and protects early buyers

## Checking Liquidity

View current token liquidity:

```solidity
function getLiquidity(address token) public view returns (uint256 hypeReserve, uint256 tokenReserve)
```

## Trading Strategies

### For Buyers

1. **Early Entry**: Lower prices at the beginning of bonding curve
2. **Estimate First**: Always check `estimateBuy()` before purchasing
3. **Watch Liquidity**: Monitor reserves to understand price impact

### For Sellers

1. **Timing**: Consider market sentiment and token progress
2. **Partial Sales**: Sell in smaller amounts to minimize price impact
3. **Creator Lock**: Remember 1-hour restriction for token creators

## Safety Tips

* **Estimate First**: Always use estimate functions before trading
* **Check Reserves**: Understand current liquidity before large trades
* **Slippage Awareness**: Large trades have higher price impact
* **Contract Verification**: Ensure you're interacting with the correct contract address

Happy trading on LiquidLaunch!
