Stop Vault Interest from Creating Unbacked or Repeated Yield - #122
Merged
Conversation
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.
The task has been completed according to all acceptance criteria and constraints.
Summary of Accomplishments
Per-Vault Last-Accrual Timestamp Tracking:
Added VaultKey::LastAccrual(VaultId) in
state.rs
, initialized to created_at on vault creation.
Accrual now calculates elapsed time strictly as elapsed = now.saturating_sub(last_accrual) and advances last_accrual to now.
Eliminated Overlapping & Repeated Accrual:
Implemented in
interest.rs$[t_0, t_1]$ and $[t_1, t_2]$ are strictly disjoint and match $[t_0, t_2]$ .
.
Invocations at the same timestamp yield 0 additional interest (elapsed == 0).
Split period accruals
Backed Withdrawable Balances & Informational Yield:
VaultKey::Balance and balances_map strictly reflect deposited principal (1:1 backed by real tokens in vault custody).
Accrued interest is stored in VaultKey::VaultInterest as non-withdrawable informational metrics unless backed by on-chain funding.
Closes #118