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.rewardCycleLengthNotes
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 constantsBOND_LENGTH_CYCLESandBOND_GAP_CYCLES. Both SDK constants are marked@internal.The contract uses
(+ bond-index u6)for the bond's end inis-bond-active-at-heightandget-bond-l1-unlock-height.A member of bond
ncan roll into bondn + 6without overlap, because its first reward cycle is the first cycle after bondn's 12-cycle term.
Definition
Was this helpful?