Adding Heirs
Heirs are registered when the vault is created by passing a list of{ heir: principal, split-bps: uint } tuples to create-vault:
The contract enforces a minimum of 1 heir and a maximum of 10. Providing zero heirs or more than 10 will fail validation.
Basis Points Explained
Splits are expressed in basis points (bps), where 10,000 basis points equals 100%.| Basis Points | Percentage |
|---|---|
| 10000 | 100% |
| 7000 | 70% |
| 5000 | 50% |
| 3333 | 33.33% |
| 2500 | 25% |
| 1000 | 10% |
| 100 | 1% |
split-bps values must equal exactly 10,000. Any deviation — even by 1 basis point — causes the transaction to fail with ERR-INVALID-SPLITS (u106).
| Heirs | Split |
|---|---|
| 1 heir | 10000 |
| 2 equal | 5000 + 5000 |
| 3 equal | 3334 + 3333 + 3333 |
| 70 / 30 | 7000 + 3000 |
| 50 / 25 / 25 | 5000 + 2500 + 2500 |
How Share Calculation Works
When an heir callsclaim(), the contract calculates their share using floor integer division:
| Heir | Split | Calculation | Receives |
|---|---|---|---|
| Heir A | 7000 bps (70%) | floor(1,000,000 × 7000 / 10000) | 700,000 sats |
| Heir B | 3000 bps (30%) | floor(1,000,000 × 3000 / 10000) | 300,000 sats |
Updating Heirs
The heir list and splits can be changed at any time while the vault is not distributed — including during thegrace and claimable states:
update-heirs function:
- Replaces the entire heir list (it is not additive).
- Resets
heir-countto the length of the new list. - Does not reset the
claims-countor existing claim records.
Finding Your Vault as an Heir
The Heirloom app’s Claim page auto-discovers vaults where your connected wallet is a registered heir by querying the Hiro API for contract events associated with your address. To look up a specific vault manually, callget-heir-info with the vault owner’s address and your address:
Independent Claiming
Each heir claims their share independently. There is no requirement for all heirs to claim at the same time, and one heir’s claim does not trigger another’s.Vault becomes claimable
elapsed-seconds exceeds heartbeat-interval + grace-period (plus any guardian pause bonus). The vault state transitions to claimable.Heir calls claim()
Any registered heir calls
claim(vault-owner-address). The contract verifies the vault is claimable, the caller is a registered heir, and the heir has not already claimed.Tokens transferred
The contract calculates the heir’s sBTC and USDCx shares and transfers them via
as-contract?. The vault’s tracked balances are decremented.Error Codes for Heirs
| Error | Code | Meaning |
|---|---|---|
ERR-NOT-HEIR | u101 | The calling address is not registered as an heir for this vault |
ERR-VAULT-NOT-FOUND | u103 | No vault exists for the specified owner address |
ERR-VAULT-NOT-CLAIMABLE | u104 | The vault has not yet entered the claimable state |
ERR-ALREADY-CLAIMED | u105 | This heir has already claimed their share |
ERR-VAULT-DISTRIBUTED | u110 | The vault is already fully distributed |
What Happens If an Heir Never Claims
Theclaim() function is a pull model — the contract does not push tokens to heirs. If an heir never calls claim(), their share remains locked in the contract indefinitely.
Consequences:
- The vault never reaches
distributedstate (becauseclaims-countnever equalsheir-count). - Other heirs’ shares are not affected — they can claim their own portion at any time.
- The owner can call
emergency-withdraw()to reclaim all remaining assets (including unclaimed heir shares) as long as the vault is not yet fully distributed. - The vault cannot be recreated until
is-distributedbecomestrue(via all heirs claiming or emergency-withdraw).
