Feat/16/integration test 정산 버그 수정 및 매칭·정산 통합 테스트#17
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis PR fixes a double-asset bug in buy-side settlement by refactoring locked-amount tracking: Order now recalculates locked amounts per side during fills with proper rounding; Wallet adds consumeLocked() to decouple locked consumption from refunds; OrderService computes buyer refunds from locked-amount deltas instead of quote amounts. Comprehensive integration tests validate settlement scenarios and invariants. ChangesSettlement Logic Bug Fix
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
변경 내용
버그 수정
기존
buyerQuoteWallet.unlock(quoteAmount)호출이 매수자에게 quoteAmount를 반환하면서동시에 매도자에도 deposit되어 자산이 이중 생성되는 문제를 수정
Wallet.consumeLocked()추가 — locked만 차감, available 반환 없음Order.fill()— 체결마다 lockedAmount 갱신 (amountScale 적용)Order.releasableAmount()— lockedAmount 직접 반환으로 단순화Order.cancel()— lockedAmount = ZERO 처리OrderService.settle()— buyerReleased / buyerRefund 정확하게 계산통합 테스트
Test plan
MatchingSettlementTest7개 테스트 전체 통과OrderApiTest회귀 없음관련 이슈
closes #16
Summary by CodeRabbit
Release Notes
Bug Fixes
Tests