Skip to content

feat(vaults): track locked and securitized satoshis#415

Open
blakebyrnes wants to merge 2 commits intomainfrom
pr/treasury-market
Open

feat(vaults): track locked and securitized satoshis#415
blakebyrnes wants to merge 2 commits intomainfrom
pr/treasury-market

Conversation

@blakebyrnes
Copy link
Contributor

Add locked_satoshis alongside securitized_satoshis and keep treasury caps based on securitized satoshis (sats * securitization ratio).

Thread securitization_ratio through satoshi provider add/reduce paths, use saturating accrue/reduce accounting, and fold locked/securitized backfill into the existing v13 migration.

Update docs, mocks, tests, and regenerate client metadata/spec artifacts.

Copilot AI review requested due to automatic review settings February 27, 2026 19:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates vault accounting to separately track locked satoshis and securitized satoshis (locked sats multiplied by the lock’s securitization ratio), and switches treasury pool caps to be derived from securitized satoshis.

Changes:

  • Add locked_satoshis to the Vault struct and backfill both locked/securitized satoshi totals via the existing vaults migration.
  • Thread securitization_ratio through the Bitcoin lock → vault provider accounting paths and use saturating accrue/reduce updates.
  • Update treasury provider interfaces, tests, docs, and regenerate Rust/NodeJS client metadata artifacts.

Reviewed changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
primitives/src/vault.rs Updates provider traits and extends Vault with locked_satoshis.
pallets/vaults/src/lib.rs Initializes and mutates locked_satoshis/securitized_satoshis via provider methods using a passed ratio.
pallets/vaults/src/tests.rs Extends tests to validate locked vs. securitized tracking under different ratios.
pallets/vaults/src/migrations/mod.rs Migrates/backfills locked + securitized satoshi totals from funded locks (including ratio).
pallets/bitcoin_locks/src/lib.rs Passes lock.securitization_ratio into vault add/reduce accounting calls on fund/release paths.
pallets/bitcoin_locks/src/mock.rs Updates mock vault provider to track both locked and securitized satoshis with ratio-aware accounting.
pallets/treasury/src/lib.rs Switches treasury per-slot cap calculation to use get_securitized_satoshis.
pallets/treasury/src/tests.rs Updates tests to reflect securitized-satoshi-based caps and adds an explicit cap test.
pallets/treasury/src/mock.rs Updates mock vault shape/provider to expose securitized_satoshis and adds a setter helper for tests.
pallets/treasury/src/migrations/mod.rs Updates migration test scaffolding for renamed mock vault field.
docs/running-a-vault.md Updates treasury pool documentation to reference securitized satoshis.
client/src/spec.rs Regenerates runtime metadata hash and reflected types/docs.
client/nodejs/src/interfaces/types-lookup.ts Regenerates lookup types to include lockedSatoshis and remove the deleted error variant.
client/nodejs/src/interfaces/lookup.ts Regenerates type lookup mapping for new vault field and updated error enum.
client/nodejs/src/interfaces/augment-api-events.ts Updates event docs to match new terminology.
client/nodejs/src/interfaces/augment-api-errors.ts Removes the deleted treasury error from augmented errors.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Add locked_satoshis alongside securitized_satoshis and keep treasury caps based on securitized satoshis (sats * securitization ratio).

Thread securitization_ratio through satoshi provider add/reduce paths, use saturating accrue/reduce accounting, and fold locked/securitized backfill into the existing v13 migration.

Update docs, mocks, tests, and regenerate client metadata/spec artifacts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants