How indubitablysrivathsan/pledgerail works
PledgeRail is a prototype secured-credit platform: borrowers pledge collateral, custodians endorse it, lenders activate credit lines, payments draw against available credit, and changing prices can trigger margin cures or liquidation. Repayment releases collateral; portability transfers a line between lenders. The React application is the role-based entry point to a Go API, which coordinates domain services, a projection store, and a ledger adapter. A separate Python risk engine analyzes price events and requests backend revaluation; chaincode independently validates ledger transactions. Some internal links are based on README documentation and the source index, since many implementation files were not excerpted.
Main entry points: App.tsx React application · routes.go HTTP API · routes.py Risk API · main.go Contract dispatch
Components 34
Role-based client
- React application
frontend/src/app/App.tsx - Collateral console
frontend/src/features/collateral/CollateralPage.tsx - Custodian console
frontend/src/features/collateral/CustodianConsole.tsx - Borrower dashboard
frontend/src/features/dashboard/BorrowerDashboard.tsx - Credit lines
frontend/src/features/credit-lines/CreditLinesPage.tsx - Payments
frontend/src/features/payments/PaymentPage.tsx - Margin management
frontend/src/features/margin/MarginPage.tsx - Liquidations
frontend/src/features/liquidation/LiquidationsPage.tsx - Lender console
frontend/src/features/lender/LenderConsole.tsx - Price publisher
frontend/src/features/publisher/PublisherConsole.tsx - Storm dashboard
frontend/src/features/storm/StormDashboard.tsx - Supervisor dashboard
frontend/src/features/supervisor/SupervisorDashboard.tsx - Ledger explorer
frontend/src/features/ledger/LedgerPage.tsx
Credit platform
- HTTP API
backend/internal/server/routes.go - Collateral and pricing
backend/internal/collateral/collateral.go - Credit-line service
backend/internal/creditline/creditline.go - Payment service
backend/internal/payments/payments.go - Margin service
backend/internal/margin/margin.go - Liquidation service
backend/internal/liquidation/liquidation.go - Portability service
backend/internal/portability/portability.go - Ledger adapter
backend/internal/ledger/drunix.go - Application projection
backend/internal/repository/repository.go
Risk analysis
- Risk API
risk-engine/app/api/routes.py - Exposure monitoring
risk-engine/app/monitoring/monitor.py - Price replay
risk-engine/app/replay/replay.py - Event publisher
risk-engine/app/event_publisher/publisher.py - Price providers
risk-engine/app/providers/base.py - Price history
risk-engine/app/pricing/repository.py
Permissioned ledger
- Contract dispatch
chaincode/main.go - Pledge contract
chaincode/contracts/pledge/pledge.go - Credit-line contract
chaincode/contracts/creditline/creditline.go - Margin contract
chaincode/contracts/margin/margin.go - Liquidation contract
chaincode/contracts/liquidation/liquidation.go
Other components
- Platform users
Connections 38
- Platform users → React application: use
README.md - React application → Collateral console: routes to
frontend/src/app/App.tsx - React application → Custodian console: routes to
frontend/src/app/App.tsx - React application → Borrower dashboard: routes to
frontend/src/app/App.tsx - React application → Credit lines: routes to
frontend/src/app/App.tsx - React application → Payments: routes to
frontend/src/app/App.tsx - React application → Margin management: routes to
frontend/src/app/App.tsx - React application → Liquidations: routes to
frontend/src/app/App.tsx - React application → Lender console: routes to
frontend/src/app/App.tsx - React application → Price publisher: routes to
frontend/src/app/App.tsx - React application → Storm dashboard: routes to
frontend/src/app/App.tsx - React application → Supervisor dashboard: routes to
README.md - React application → Ledger explorer: routes to
frontend/src/app/App.tsx - React application → HTTP API: HTTP requests
README.md - HTTP API → Collateral and pricing: calls
backend/internal/server/routes.go - HTTP API → Credit-line service: calls
backend/internal/server/routes.go - HTTP API → Payment service: calls
backend/internal/server/routes.go - HTTP API → Margin service: calls
backend/internal/server/routes.go - HTTP API → Liquidation service: calls
backend/internal/server/routes.go - HTTP API → Portability service: calls
backend/internal/server/routes.go - HTTP API → Application projection: reads and writes
- Collateral and pricing → Ledger adapter: commits transactions
- Credit-line service → Ledger adapter: commits transactions
- Payment service → Ledger adapter: records drawdowns
- Margin service → Liquidation service: initiates
- Ledger adapter → Contract dispatch: invokes contracts
- Contract dispatch → Pledge contract: dispatches
chaincode/main.go - Contract dispatch → Credit-line contract: dispatches
chaincode/main.go - Contract dispatch → Margin contract: dispatches
chaincode/main.go - Contract dispatch → Liquidation contract: dispatches
chaincode/main.go - HTTP API → Risk API: publishes prices
- Risk API → HTTP API: requests revaluation
README.md - Risk API → Exposure monitoring: runs monitoring
- Risk API → Price replay: runs replay
- Risk API → Price providers: selects provider
risk-engine/app/main.py - Risk API → Price history: loads history
risk-engine/app/main.py - Risk API → Event publisher: creates publisher
risk-engine/app/main.py - Event publisher → Price history: persists ticks