feat(wrapper): [Storage] Define VaultState struct (#715) - #831
Open
TochukwuJustice wants to merge 1 commit into
Open
feat(wrapper): [Storage] Define VaultState struct (#715)#831TochukwuJustice wants to merge 1 commit into
TochukwuJustice wants to merge 1 commit into
Conversation
… fee vaults - Define VaultState struct storing fee rates, limits, exchange rate, and fee accumulation metrics - Add DataKey::VaultState preserving storage discriminant ordering - Implement set_vault_state and get_vault_state contract entrypoints with strict invariant validation - Add emit_vault_state_set contract event - Add comprehensive unit test suite covering happy paths and error states - Extend TypeScript SDK WrapperClient with VaultState interface, getter, and setter methods
|
@TochukwuJustice Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
@TochukwuJustice please fix CI and conflicts |
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.
closes #715
Summary of Changes
This pull request implements Issue #715: [Storage] Define VaultState struct under the Yield-Bearing Fee Vaults epic:
VaultState): Encapsulatesfee_rate_bps(u32),fee_receiver(Address),min_deposit(i128),max_deposit(i128),exchange_rate(i128),accumulated_fees(i128), andlast_update_timestamp(u64).DataKey::VaultStatestrictly as the last discriminant in theDataKeyenum, preserving upgrade compatibility and preventing storage slot collision.set_vault_state(admin-gated with parameter bounds checks) andget_vault_statepublic view method onWrapperContract.emit_vault_state_setevent ("v_state"topic).VaultStateinterface,getVaultState(), andsetVaultState()methods toWrapperClientin@bc-forge/sdk.contracts/wrapper/src/test.rscovering happy path configuration, unauthorized caller rejection, invariant validation (fee rate bounds, limit ranges, positive exchange rate, non-negative fees), and storage slot isolation.Reason for Changes
Yield-bearing fee vaults require persistent storage of global vault parameters, deposit thresholds, exchange pricing, and fee accumulation to enable fee distribution, capital tracking, and yield accrual mechanisms without breaking existing token wrapping features.