Skip to main content

calculateStakerPosition

Description:

Calculates the staker's net APY and total assets across the wallet, mint and boost from the result of getPositionData and optional deltas. Synchronous, no requests. Zero deltas return the current position. For a single vault use calculateAllocatorPosition.

Arguments:

NameTypeRequiredDescription
dataPositionDataYesResult of getPositionData
stakedAssetsDeltabigintNoChange in staked assets. Defaults to 0n
mintedSharesDeltabigintNoChange in minted osToken shares. Defaults to 0n
boostedSharesDeltabigintNoChange in boosted osToken shares. Defaults to 0n

Returns:

type Output = {
apy: number
totalAssets: bigint
}

Example:

const data = await sdk.vault.getPositionData({
userAddress: '0x...',
vaultAddress: '0x...',
})

const { apy, totalAssets } = sdk.vault.helpers.calculateStakerPosition({
data,
stakedAssetsDelta: parseEther('1'),
})