> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lfg.rich/llms.txt
> Use this file to discover all available pages before exploring further.

# Floor Price Protection

> How the V5 floor-price mechanism protects official LFG.RICH token launches.

The floor price is one of the most important protections in LFG.RICH V5.

For official V5 tokens, the public rule is simple:

> **The protocol floor is always based on 50% of the token's all-time high price.**

<CardGroup cols={2}>
  <Card title="50% of ATH" icon="percent">
    The floor target is calculated from the token's all-time high price using `autoFloorPctBps = 5000`.
  </Card>

  <Card title="Only moves up" icon="arrow-trend-up">
    When ATH rises, the floor can rise. When price falls, the floor does not go down.
  </Card>

  <Card title="Enforced by the Hook" icon="anchor">
    The creator cannot manually lower the protocol floor after launch.
  </Card>

  <Card title="Used by borrowing" icon="landmark">
    Borrowing power is based on floor value, which is why a higher floor can enable `borrowMore(poolId)`.
  </Card>
</CardGroup>

When the token reaches a new all-time high, the Hook records that new ATH and raises the floor target to half of it. If the price later falls, the ATH does not reset and the floor does not go down.

This means the floor is not controlled by the creator, by a market maker, or by manual team action. It is protocol state enforced by the **Uniswap V4 Hook**.

## Core idea

The V5 Hook tracks two important prices for every official token pool:

| Value              | Meaning                                               |
| ------------------ | ----------------------------------------------------- |
| `allTimeHighPrice` | The highest effective price the token has reached.    |
| `floorPrice`       | The minimum effective price enforced by the protocol. |

The default floor rule is:

```txt theme={null}
floorPrice = 50% of allTimeHighPrice
```

In basis points, this is stored as:

```txt theme={null}
autoFloorPctBps = 5000
```

Because 10,000 basis points = 100%, 5,000 basis points = 50%.

## Simple example

| Event                              |   Effective price |       ATH |      Floor |
| ---------------------------------- | ----------------: | --------: | ---------: |
| Token starts                       |                 0 |         0 |          0 |
| First buys push price to 0.001 BNB |         0.001 BNB | 0.001 BNB | 0.0005 BNB |
| More buys push price to 0.01 BNB   |          0.01 BNB |  0.01 BNB |  0.005 BNB |
| Sells push price down              |         0.005 BNB |  0.01 BNB |  0.005 BNB |
| The price tries to go lower        | 0.005 BNB minimum |  0.01 BNB |  0.005 BNB |
| New rally reaches 0.02 BNB         |          0.02 BNB |  0.02 BNB |   0.01 BNB |

The most important point is that the floor follows the ATH upward, but it does not follow the price downward.

## What happens when a new ATH is reached

After trades, the Hook can update the token's ATH and floor state.

The flow is:

<Steps>
  <Step title="Hook calculates the current effective price">
    The current protocol price is checked after trades update the pool state.
  </Step>

  <Step title="New ATH is stored when reached">
    If the effective price is higher than the previous `allTimeHighPrice`, the Hook stores the new ATH.
  </Step>

  <Step title="Floor target is calculated from autoFloorPctBps">
    The default V5 value is `5000`, meaning 50%.
  </Step>

  <Step title="Floor is raised to 50% of ATH">
    When the calculated floor target is higher than the current `floorPrice`, the Hook raises the floor.
  </Step>

  <Step title="Floor does not move down later">
    If the market falls, the ATH and floor remain in place.
  </Step>
</Steps>

The Hook emits events for these changes:

```solidity theme={null}
event ATHUpdated(bytes32 indexed poolId, uint256 oldATH, uint256 newATH);
event FloorRaised(bytes32 indexed poolId, uint256 oldFloor, uint256 newFloor);
```

These events are useful for explorers, indexers, charts, and frontend activity feeds.

## Why the floor cannot simply be changed manually

The floor is derived from on-chain pool state. It is not a setting that the token creator can lower after launch.

A creator cannot withdraw liquidity and cannot lower the floor to create a rug-style collapse. Official V5 tokens are routed through the protocol contracts, where the **Uniswap V4 Hook** controls pricing, floor enforcement, reserves, fees, collateral, borrowing, and hook callbacks.

## Effective price and floor price

The Hook exposes the effective price:

```solidity theme={null}
function getEffectivePrice(bytes32 poolId) view returns (uint256);
```

The effective price is the price users and integrations should use when displaying current protocol price. It respects the floor.

A sell can move the bonding-curve price down, but the effective price should not be displayed below the current `floorPrice`.

## V5 floor state

The Hook exposes the full token state per `poolId`:

```solidity theme={null}
function tokenStates(bytes32 poolId)
    view
    returns (
        address token,
        address creator,
        uint256 floorPrice,
        uint256 realETH,
        uint256 virtualETH,
        uint256 totalBorrowedETH,
        uint256 collateralSupply,
        uint256 allTimeHighPrice,
        uint256 k,
        uint256 autoFloorPctBps,
        bool initialized
    );
```

Important floor-related fields:

| Field              | Meaning                                                                                            |
| ------------------ | -------------------------------------------------------------------------------------------------- |
| `floorPrice`       | Current minimum protocol price.                                                                    |
| `allTimeHighPrice` | Highest effective price reached by the token.                                                      |
| `autoFloorPctBps`  | Floor percentage in basis points. In V5 this is normally `5000`, meaning 50% of ATH.               |
| `realETH`          | Native BNB actually available in the pool accounting. The contract field keeps the ETH-style name. |
| `virtualETH`       | Virtual backing created by borrow accounting.                                                      |
| `totalBorrowedETH` | Total native BNB borrowed against this pool.                                                       |
| `collateralSupply` | Tokens locked as borrow collateral.                                                                |
| `k`                | Internal curve parameter used by the Hook pricing logic.                                           |

## Reading the current floor

Integrations should always resolve the correct `poolId` first, then read Hook state for that pool.

```ts theme={null}
const poolId = token.pool_id || token.poolId || await hook.tokenToPoolId(tokenAddress);

const state = await hook.tokenStates(poolId);
const effectivePrice = await hook.getEffectivePrice(poolId);
const autoFloorPctBps = await hook.getAutoFloorPct(poolId);

console.log({
  floorPrice: state.floorPrice.toString(),
  allTimeHighPrice: state.allTimeHighPrice.toString(),
  autoFloorPctBps: autoFloorPctBps.toString(), // normally 5000 = 50%
  effectivePrice: effectivePrice.toString()
});
```

Do not assume that a token address is enough for V5 reads. V5 routing is pool-based. Always resolve and use the token's `poolId`.

## Solvency protection

The main public rule is 50% of ATH. The Hook also protects the system from impossible floor states by checking how much effective backing exists.

The important backing idea is:

```txt theme={null}
effective backing = realETH + virtualETH
```

The Hook exposes the maximum floor currently supportable by the pool:

```solidity theme={null}
function maxFloorPrice(bytes32 poolId) view returns (uint256);
```

This safety check exists so the floor remains enforceable by the protocol accounting. It does not give creators manual control over the floor, and it does not allow the floor to be lowered after it has been raised.

## Floor price and borrowing

Borrowing is based on floor value, not on temporary price spikes.

When a user borrows against their tokens, the Hook uses the token's floor-price value to calculate borrowing power. This is why the floor mechanism is directly connected to lending:

* If the token reaches a new ATH, the floor can rise to 50% of that ATH.
* A higher floor increases the floor-value of token collateral.
* If a user already has locked collateral and the floor rises later, they may be able to use `borrowMore(poolId)` to borrow the additional available value.
* If the market price falls after the ATH, the borrow base does not fall with it because the floor does not go down.

This is also why user interfaces should clearly show both:

| Display value           | Why it matters                                                       |
| ----------------------- | -------------------------------------------------------------------- |
| Current effective price | Shows the current protocol trading price.                            |
| ATH                     | Shows the highest effective price reached.                           |
| Floor price             | Shows the minimum enforced price and the base used for borrow value. |
| Floor percentage        | Shows that the V5 rule is 50% of ATH.                                |

## What this means for users

The floor mechanism gives official V5 tokens a built-in downside boundary inside the protocol.

It means:

* The creator cannot remove the protocol-managed backing like a traditional LP rug.
* The token's floor rises when the token makes a new ATH.
* The standard V5 floor target is 50% of ATH.
* Once the floor rises, it does not go back down.
* Borrowing uses floor value, not a temporary market spike.

## Important risk note

The floor protects official protocol pricing inside the LFG.RICH V5 contracts. Users should still understand smart contract risk, chain risk, wallet risk, routing risk, indexing risk, and market risk before trading.
