Skip to content

EarnShares.toAmount

Converts venue shares to a vault share amount at the anchor rate, rounding down.

Mirrors VaultAdapter.sharesToTokens.

Imports

Named
import { EarnShares } from 'ox/tempo'

Examples

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

Definition

function toAmount(
  anchor: Anchor,
  venueShareAmount: bigint,
): bigint

Source: src/tempo/EarnShares.ts

Parameters

anchor

The conversion anchor.

anchor.engineShares

  • Type: bigint

Venue shares held by the engine at the anchor point.

anchor.shareSupply

  • Type: bigint

Vault share supply at the anchor point.

venueShareAmount

  • Type: bigint

Venue share amount, base units.

Return Type

Vault share amount, rounded down.

bigint