AI: Explore architectural decomposition of FlowALP contracts#312
Closed
jordanschalm wants to merge 1 commit into
Closed
AI: Explore architectural decomposition of FlowALP contracts#312jordanschalm wants to merge 1 commit into
jordanschalm wants to merge 1 commit into
Conversation
Add architecture review document and sample interface definitions for decomposing the monolithic Pool resource into specialized modules: - ReserveVaultManager: purpose-specific vault withdrawal API with distinct entitlements per withdrawal reason (position, liquidation, fee) - TokenLedger: effects-based balance mutations replacing hidden side effects in InternalBalance.recordDeposit/Withdrawal, colocated risk factors - PositionRegistry: position lifecycle and balance tracking - FeeCollector: separated fee calculation from execution - LiquidationEngine: pure validation returning LiquidationPlan structs - PoolCoordinator: thin orchestrator showing how modules compose Key issues identified: - Pool is a ~1200-line God Object handling 10+ concerns - PoolState is a flat bag with single EImplementation entitlement for all access - Reserves are directly borrowable by any internal code path - InternalBalance.recordDeposit has hidden side effects on global TokenState - Health/balance sheet logic duplicated across 4+ code paths - Fee collection interleaved with core lending operations https://claude.ai/code/session_01VfmgLV2Ev1eGFebdYMjaGz
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.
No description provided.