feat(vaults): track locked and securitized satoshis#415
Open
blakebyrnes wants to merge 2 commits intomainfrom
Open
feat(vaults): track locked and securitized satoshis#415blakebyrnes wants to merge 2 commits intomainfrom
blakebyrnes wants to merge 2 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
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_satoshisto the Vault struct and backfill both locked/securitized satoshi totals via the existing vaults migration. - Thread
securitization_ratiothrough 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.
87819c5 to
1d090c1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.