Implement Core Portfolio Management Functionality for DynamoFi#1
Open
Implement Core Portfolio Management Functionality for DynamoFi#1
Conversation
- Implemented get-portfolio, get-portfolio-asset, and get-user-portfolios read-only functions - Enables efficient querying of portfolio and asset details by users - Improves protocol transparency and user experience
- Implemented calculate-rebalance-amounts read-only function - Added private functions for token ID and percentage validation - Improves portfolio integrity and supports automated rebalancing logic
- Implemented add-to-user-portfolios to manage user portfolio lists - Added initialize-portfolio-asset and initialize-token-at-index for asset setup - Streamlines portfolio creation and asset allocation processes
- Adds create-portfolio to allow users to create portfolios with custom tokens and allocations - Initializes up to 10 tokens per portfolio and validates input constraints - Updates user portfolio list and increments portfolio counter - Enhances protocol usability and onboarding for new portfolios
- Implemented rebalance-portfolio to update last rebalanced timestamp - Added update-portfolio-allocation for dynamic asset allocation changes - Introduced initialize for protocol ownership transfer - Improves protocol flexibility, security, and portfolio management
- Provides detailed protocol overview, architecture, and smart contract logic - Documents features, security, error handling, and roadmap - Improves developer onboarding and project transparency
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.
Summary:
This PR introduces the core functionality for the DynamoFi protocol smart contracts, enabling users to create, manage, and track self-custodial portfolios on the Stacks L2.
Key Changes:
Read-Only Functions
get-portfolio: Fetch portfolio metadata by ID.get-portfolio-asset: Retrieve asset details by portfolio and index.get-user-portfolios: List all portfolio IDs owned by a user.calculate-rebalance-amounts: Determines if rebalancing is required.Private Helpers
initialize-token-at-index,initialize-portfolio-asset,add-to-user-portfoliosPublic Functions
create-portfolio: Creates a new portfolio with up to 10 token allocations (basis point-based).rebalance-portfolio: Updates portfolio state post-rebalancing.update-portfolio-allocation: Allows users to adjust target allocations.initialize: Sets the protocol owner/admin.Benefits:
Developer Notes: