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

# Non-Trivial Financial Logic

> Formulas and validation rules for payouts, fees, and liquidity.

### Proportional Share Calculation

variable side earnings are based on proportional ownership of total supply and total generated yield.

```solidity theme={null}
share = mulDiv(userTokens, totalEarnings, totalTokens);
```

* Uses mulDiv to avoid rounding loss and overflow

***

### Liquidity Tolerance Protection

To prevent misconfiguration or malicious deviation in liquidity provisioning, adapters enforce strict tolerance bounds.

Example: **100 bps tolerance (±1%)**

```solidity theme={null}
require(actualLiquidity >  targetLiquidity * 9900 / 10000,  "L");
require(actualLiquidity <= targetLiquidity * 10100 / 10000, "Excessive liquidity");
```

* Ensures the deployed liquidity matches expectations within an acceptable error window
