fix: resolve Tailwind v3/v4 token drift (issue #XX)#522
Open
BernardOnuh wants to merge 1 commit into
Open
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.
This PR removes the redundant DataKey::Balance storage and makes Shares the single source of truth for user accounting.
Previously the contract maintained both a balance value and a share value for each user. Since yield accrual changes the asset value represented by shares, the two values could diverge over time, increasing complexity and audit risk.
Changes
Removed dependency on DataKey::Balance.
Updated deposit flow to mint and track shares only.
Updated withdraw flow to calculate redeemable assets from shares.
Refactored balance getters to derive assets directly from shares.
Simplified accounting logic and reduced storage redundancy.
Added migration guidance for existing deployments.
Added test coverage for share-derived balance calculations.
Migration Notes
Existing deployments storing DataKey::Balance should migrate to share-derived accounting.
Recommended approach:
Treat existing shares as the authoritative state.
Derive balances from shares using the current asset/share conversion rate.
Deprecate and ignore legacy Balance entries after migration.
Testing
Added/updated tests to verify:
Deposits correctly mint shares.
Withdrawals correctly burn shares.
Yield accrual increases share-derived asset value.
get_balance() matches assets derived from shares.
No balance calculations depend on DataKey::Balance.
Acceptance Criteria
Balance storage deprecated/removed.
Shares are the single source of truth.
Migration path documented.
Tests prove get_balance() equals share-derived assets.
Deposit and withdrawal flows operate correctly under shares-only accounting.
closes #184