Audit Stablecoin Transfer Events Against a State Machine

Last updated: November 29, 2026

Quick Overview

Given a stream of (transfer_id, new_state, timestamp) events for stablecoin and fiat transfers, replay them against an allowed-transition table and report each transfer's final state or its first illegal transition.

Bridge
Coding & Algorithms
Software Engineer
Bridge
November 29, 2026
Software Engineer
Phone Screen
Coding & Algorithms
Easy

0

0

0 solved


Given a stream of (transfer_id, new_state, timestamp) events for stablecoin and fiat transfers, replay them against an allowed-transition table and report each transfer's final state or its first illegal transition.

Bridge transfers move through states such as awaiting_funds, funds_received, payment_submitted and payment_processed, with returns and refunds on the side. A practical phone screen like this checks that you can model a lifecycle as data, handle duplicate and out-of-order events calmly, and write clean code quickly.

What the Interviewer Expects
  • Represent allowed transitions as a table, not nested if statements
  • Sort or otherwise order events by timestamp before replaying
  • Treat a repeated delivery of the same state as a no-op rather than an error
  • Stop processing a transfer after its first illegal transition and say why
  • Run through a small example out loud and state complexity
Key Topics to Cover
state machines
event replay
idempotent processing
hash maps
payment lifecycles
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you handle two events with the same timestamp but different states?
  • What changes if events can arrive late, after you have already reported a final state?
  • How would you expose this as a reconciliation job that pages someone on invalid transitions?
  • Where should this transition table live so that the API, workers and webhooks share it?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Input is an unordered list of events. Every transfer must start in awaiting_funds. A transition is legal only if the table allows it. Output, per transfer, either the latest valid state or a message...

High-Level Design

Keep the lifecycle as a dict from state to the set of states it may move to. Terminal states (payment_processed, refunded, canceled) map to an empty set. Sort events by timestamp (stable, so tie...


Submit Your Answer
Markdown supported

Related Questions