Skip to content

fix: resolve CEI violations and remove state mutation from invoice read flow#528

Merged
sanmipaul merged 1 commit into
astera-hq:mainfrom
0xMegie:megieee
May 28, 2026
Merged

fix: resolve CEI violations and remove state mutation from invoice read flow#528
sanmipaul merged 1 commit into
astera-hq:mainfrom
0xMegie:megieee

Conversation

@0xMegie
Copy link
Copy Markdown
Contributor

@0xMegie 0xMegie commented May 28, 2026

closes #318 - Reordered deposit() to follow strict CEI (Checks-Effects-Interactions) flow by performing share minting and state updates before external stablecoin transfers. Added regression tests to ensure failed share mint operations do not transfer investor funds.

closes #319 - Updated withdraw() execution order to ensure storage updates, share burns, and accounting changes occur before outgoing token transfers. Added tests validating investor state remains unchanged if transfer execution fails.

closes #320 - Refactored fund_invoice() / init_funding_request() to persist FundedInvoice records and update pool accounting before transferring USDC to SMEs. Added coverage for transfer failure rollback scenarios.

closes #322 - Removed state mutation side effects from get_invoice() by extracting expiration handling into explicit expiration logic flow. get_invoice() is now a pure read operation with no storage writes or state transitions.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 28, 2026

@0xMegie Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@sanmipaul sanmipaul merged commit 6cef938 into astera-hq:main May 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants