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

# Borrowing

> Borrow BNB by locking official LFG.RICH tokens as collateral.

LFG.RICH V5 includes collateral borrowing for official tokens. Users can lock tokens as collateral and borrow native BNB against the token's floor value.

Borrowing is based on the protocol floor, not temporary market spikes. There is no liquidation engine and no ongoing interest.

<CardGroup cols={2}>
  <Card title="Floor-based value" icon="shield-halved">
    Borrowing power is calculated from the protocol floor instead of short-term market price spikes.
  </Card>

  <Card title="No liquidation engine" icon="lock">
    V5 borrowing does not use a traditional liquidation mechanism.
  </Card>

  <Card title="Fixed 3% fee" icon="percent">
    Borrowing has a one-time 3% fee, split between platform and direct parent/platform depending on referral state.
  </Card>

  <Card title="Borrow more" icon="arrow-up-right-dots">
    If the floor rises, existing collateral may support additional borrowing through `borrowMore(poolId)`.
  </Card>
</CardGroup>

## Key properties

* Borrowing power is based on floor value.
* Locked collateral is removed from circulating supply while the borrow position is active.
* Borrowing has no liquidation mechanism.
* Borrowing has no ongoing interest.
* A fixed one-time 3% borrow fee is deducted from the borrowed value.
* Partial repayment unlocks a proportional amount of collateral.
* Full repayment unlocks the remaining collateral.
* Borrow state is stored per `poolId` and user.

## Borrowing flow

The V5 borrow flow is:

<Steps>
  <Step title="Resolve token poolId">
    Borrow state is stored per `poolId` and user.
  </Step>

  <Step title="Approve the Hook">
    The Hook must be approved to transfer the collateral tokens.
  </Step>

  <Step title="Call hook.borrow(poolId, amount)">
    The borrow action is executed through the Hook, not the Swap Router.
  </Step>

  <Step title="Hook locks collateral">
    Tokens are transferred into collateral accounting and removed from circulating supply while locked.
  </Step>

  <Step title="Hook records debt">
    Debt is recorded as the gross borrowed value.
  </Step>

  <Step title="User receives net BNB">
    The borrower receives BNB after the fixed 3% borrow fee is deducted.
  </Step>
</Steps>

Function:

```solidity theme={null}
function borrow(bytes32 poolId, uint256 amount);
```

The user must approve the Hook, not the Swap Router:

```solidity theme={null}
approve(HOOK_ADDRESS, amount)
```

## Borrow fee

The V5 borrow fee is fixed at 3% of the gross borrowed value.

```txt theme={null}
Gross borrow value: 1.00 BNB
Borrow fee:        0.03 BNB
User receives:     0.97 BNB
Debt recorded:     1.00 BNB
```

Debt is recorded as the gross borrowed value, not only the net amount the user receives.

## Repayment flow

Users repay by sending BNB to:

```solidity theme={null}
function repay(bytes32 poolId) payable;
```

If the repayment is partial, the protocol unlocks a proportional amount of collateral. If the repayment closes the debt, the remaining collateral is unlocked.

If a user sends more than the outstanding debt, the contract handles repayment according to the debt amount and refunds the excess.

## Borrow more

If the floor rises after a borrow position is opened, the user's existing collateral may support additional borrowing.

Developers can estimate this with:

```solidity theme={null}
function estimateBorrowMore(
    bytes32 poolId,
    address user
) view returns (uint256 additionalEth, uint256 fee);
```

Then call:

```solidity theme={null}
function borrowMore(bytes32 poolId);
```

when additional value is available.

## Read functions

```solidity theme={null}
function borrowedETH(bytes32 poolId, address user) view returns (uint256);
function collateralBalance(bytes32 poolId, address user) view returns (uint256);
```

On BSC these values represent BNB, even though the Solidity names use `ETH`.
