Split FlowALPv0 further: extract health math and position resources#183
Split FlowALPv0 further: extract health math and position resources#183
Conversation
…ional Add doc comments to all four public functions in FlowALPHealth following the positionSatisfiesMinimumBalance doc style. Change interest index parameters (withdrawCreditInterestIndex, depositDebitInterestIndex) to optional types, passing nil when the balance direction doesn't match instead of a dummy 1.0 value. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Looks good. Thanks for adding this.
I verified that changes were move-only using the following diff commands against this commit (asked Claude to get the appropriate lines to diff on each branch):
diff -u -w <(git show origin/main:cadence/contracts/FlowALPv0.cdc | sed -n '650,709p') <(git show origin/liob/split-v0-health-position-resources:cadence/contracts/FlowALPHealth.cdc |
sed -n '7,71p') | delta --side-by-side --file-style omit --line-fill-method ansi
diff -u -w <(git show origin/main:cadence/contracts/FlowALPv0.cdc | sed -n '713,832p') <(git show origin/liob/split-v0-health-position-resources:cadence/contracts/FlowALPHealth.cdc |
sed -n '75,190p') | delta --side-by-side --file-style omit --line-fill-method ansi
diff -u -w <(git show origin/main:cadence/contracts/FlowALPv0.cdc | sed -n '890,966p') <(git show origin/liob/split-v0-health-position-resources:cadence/contracts/FlowALPHealth.cdc |
sed -n '193,270p') | delta --side-by-side --file-style omit --line-fill-method ansi
diff -u -w <(git show origin/main:cadence/contracts/FlowALPv0.cdc | sed -n '970,1072p') <(git show origin/liob/split-v0-health-position-resources:cadence/contracts/FlowALPHealth.cdc |
sed -n '274,377p') | delta --side-by-side --file-style omit --line-fill-method ansi
diff -u -w <(git show origin/main:cadence/contracts/FlowALPv0.cdc | sed -n '2411,2658p') <(git show
origin/liob/split-v0-health-position-resources:cadence/contracts/FlowALPPositionResources.cdc | sed -n '21,268p') | delta --side-by-side --file-style omit --line-fill-method
ansi
diff -u -w <(git show origin/main:cadence/contracts/FlowALPv0.cdc | sed -n '2665,2709p') <(git show
origin/liob/split-v0-health-position-resources:cadence/contracts/FlowALPPositionResources.cdc | sed -n '275,319p') | delta --side-by-side --file-style omit --line-fill-method
ansi
I also added this follow-up which adds documentation to the FlowALPHealth functions: #185
Add documentation to FlowALPHealth and make interest index params optional
|
Had claude generate new diffs it seems there are some changes. diff -u -w <(git show origin/main:cadence/contracts/FlowALPv0.cdc | sed -n '695,755p') <(git show \
origin/liob/split-v0-health-position-resources:cadence/contracts/FlowALPHealth.cdc | \
sed -n '6,87p') | delta --side-by-side --file-style omit --line-fill-method ansi
diff -u -w <(git show origin/main:cadence/contracts/FlowALPv0.cdc | sed -n '757,933p') <(git show \
origin/liob/split-v0-health-position-resources:cadence/contracts/FlowALPHealth.cdc | \
sed -n '89,223p') | delta --side-by-side --file-style omit --line-fill-method ansi
diff -u -w <(git show origin/main:cadence/contracts/FlowALPv0.cdc | sed -n '935,1012p') <(git show \
origin/liob/split-v0-health-position-resources:cadence/contracts/FlowALPHealth.cdc | \
sed -n '225,319p') | delta --side-by-side --file-style omit --line-fill-method ansi
diff -u -w <(git show origin/main:cadence/contracts/FlowALPv0.cdc | sed -n '1013,1118p') <(git show \
origin/liob/split-v0-health-position-resources:cadence/contracts/FlowALPHealth.cdc | \
sed -n '321,445p') | delta --side-by-side --file-style omit --line-fill-method ansi
diff -u -w <(git show origin/main:cadence/contracts/FlowALPv0.cdc | sed -n '2446,2704p') <(git show \
origin/liob/split-v0-health-position-resources:cadence/contracts/FlowALPPositionResources.cdc | sed -n '10,269p') | delta --side-by-side --file-style omit --line-fill-method \
ansi
diff -u -w <(git show origin/main:cadence/contracts/FlowALPv0.cdc | sed -n '2706,2755p') <(git show \
origin/liob/split-v0-health-position-resources:cadence/contracts/FlowALPPositionResources.cdc | sed -n '270,319p') | delta --side-by-side --file-style omit --line-fill-method \
ansi |
|
Correction from my previous comment: At this point, the remaining diffs should mainly be the structural ones required by the split itself. Exhaustive list:
Other than the doc comments in |
Summary
Why
This continues Jordan split strategy by reducing FlowALPv0 surface area and isolating pure calculation logic from resource-wrapper logic while preserving behavior.
Validation