Skip to content

fix: resolve Tailwind v3/v4 token drift (issue #XX)#522

Open
BernardOnuh wants to merge 1 commit into
Neurowealth:mainfrom
BernardOnuh:main
Open

fix: resolve Tailwind v3/v4 token drift (issue #XX)#522
BernardOnuh wants to merge 1 commit into
Neurowealth:mainfrom
BernardOnuh:main

Conversation

@BernardOnuh

Copy link
Copy Markdown
Contributor

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

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.

Split PortfolioDashboard into focused subcomponents

1 participant