Skip to content

[Feat]: WalletLedger 엔티티 및 원장 기록 구현 #10

@ohhalim

Description

@ohhalim

Branch Keyword

wallet-ledger

구현할 기능

모든 지갑 변경(잠금/해제/정산/취소)에 대해 wallet_ledgers 테이블에 append-only로 기록한다.

작업 범위

1. Flyway migration

  • wallet_ledgers 테이블 추가

2. WalletLedger 도메인

  • WalletLedger entity
  • WalletLedger repository
  • LedgerType enum (ORDER_LOCK, ORDER_CANCEL_RELEASE, TRADE_SETTLE_BUY, TRADE_SETTLE_SELL, SEED_DEPOSIT)

3. 원장 기록 연결

  • 주문 생성 시 자산 lock → ORDER_LOCK 기록
  • 주문 취소 시 잔여 lock 해제 → ORDER_CANCEL_RELEASE 기록
  • 체결 정산 시 매수자/매도자 → TRADE_SETTLE_BUY, TRADE_SETTLE_SELL 기록

API 명세

  • GET /api/v1/wallets — 사용자 지갑 잔액 조회
  • GET /api/v1/wallets/ledgers — 원장 내역 조회 (asset 필터)

테스트 계획

완료 기준

  • 모든 wallet 변경이 wallet_ledgers에 기록됨
  • delta_available, delta_locked, balance_after 값 정확
  • order_id, trade_id 참조 연결
  • 음수 잔고 없음

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions