# EarnShares

Tempo Earn `VaultAdapter` share math: raw vault-share and venue-share conversions
at the anchor rate, the dilution-correct fee-share formula, and the
`minimumOutput` slippage floor.

Conversions are fee-blind mirrors of the adapter's anchor arithmetic; use the
adapter's `previewRedeem` for user-facing value.

## Examples

```ts twoslash
import { EarnShares } from 'ox/tempo'

const shareAmount = EarnShares.toAmount(
  { engineShares: 3n, shareSupply: 2n },
  7n
)
// @log: 4n
```

## Functions

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`EarnShares.feeShares`](/tempo/reference/EarnShares/feeShares) | Computes the dilution-correct vault shares minted for an asset-denominated fee. |
| [`EarnShares.minimumOutput`](/tempo/reference/EarnShares/minimumOutput) | Lowers an expected output by a basis-point slippage tolerance, flooring to `1n`. |
| [`EarnShares.toAmount`](/tempo/reference/EarnShares/toAmount) | Converts venue shares to a vault share amount at the anchor rate, rounding down. |
| [`EarnShares.toAmountUp`](/tempo/reference/EarnShares/toAmountUp) | Converts venue shares to a vault share amount at the anchor rate, rounding up. |
| [`EarnShares.toVenueAmount`](/tempo/reference/EarnShares/toVenueAmount) | Converts a vault share amount to venue shares at the anchor rate, rounding down. |

## Errors

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`EarnShares.InvalidExpectedOutputError`](/tempo/reference/EarnShares/errors#earnsharesinvalidexpectedoutputerror) | Error thrown when an expected output is not positive. |
| [`EarnShares.InvalidSlippageError`](/tempo/reference/EarnShares/errors#earnsharesinvalidslippageerror) | Error thrown when a slippage tolerance is not an integer from `0` through `9_999`. |

## Types

| Name                | Description                         |
| ------------------- | ----------------------------------- |
| [`EarnShares.Anchor`](/tempo/reference/EarnShares/types#earnsharesanchor) | Tempo Earn `VaultAdapter` conversion anchor. |
