For the complete documentation index, see llms.txt. This page is also available as Markdown.

BOND_END_OFFSET_PERIODS

The number of bond periods between a bond's start and its end: 6. Bond n ends at the start height of bond n + 6. It is the hardcoded u6 in the contract's bond math.


Usage

import { BOND_END_OFFSET_PERIODS, bondPeriodToBurnHeight, fetchPoxInfo } from '@stacks/bitcoin-staking';

const poxInfo = await fetchPoxInfo({ network: 'mainnet' });
const bondIndex = 0;

const startHeight = bondPeriodToBurnHeight({ bondIndex, poxInfo });
const endHeight = bondPeriodToBurnHeight({ bondIndex: bondIndex + BOND_END_OFFSET_PERIODS, poxInfo });
// endHeight - startHeight === 12 * poxInfo.rewardCycleLength

Notes

  • Computed as BOND_LENGTH_CYCLES / BOND_GAP_CYCLES: a 12-cycle bond term divided by the 2-cycle gap between bond starts, matching the contract constants BOND_LENGTH_CYCLES and BOND_GAP_CYCLES. Both SDK constants are marked @internal.

  • The contract uses (+ bond-index u6) for the bond's end in is-bond-active-at-height and get-bond-l1-unlock-height.

  • A member of bond n can roll into bond n + 6 without overlap, because its first reward cycle is the first cycle after bond n's 12-cycle term.

Reference Link


Definition

Was this helpful?