Skip to content

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

import { EarnShares } from 'ox/tempo'
 
const shareAmount = EarnShares.toAmount(
  { engineShares: 3n, shareSupply: 2n },
  7n,
)
4n

Functions

NameDescription
EarnShares.feeSharesComputes the dilution-correct vault shares minted for an asset-denominated fee.
EarnShares.minimumOutputLowers an expected output by a basis-point slippage tolerance, flooring to 1n.
EarnShares.toAmountConverts venue shares to a vault share amount at the anchor rate, rounding down.
EarnShares.toAmountUpConverts venue shares to a vault share amount at the anchor rate, rounding up.
EarnShares.toVenueAmountConverts a vault share amount to venue shares at the anchor rate, rounding down.

Errors

NameDescription
EarnShares.InvalidExpectedOutputErrorError thrown when an expected output is not positive.
EarnShares.InvalidSlippageErrorError thrown when a slippage tolerance is not an integer from 0 through 9_999.

Types

NameDescription
EarnShares.AnchorTempo Earn VaultAdapter conversion anchor.