Skip to content

Instantly share code, notes, and snippets.

@patcito
Created February 19, 2026 00:20
Show Gist options
  • Select an option

  • Save patcito/8b081a346f46d8d3023aa64104a350e0 to your computer and use it in GitHub Desktop.

Select an option

Save patcito/8b081a346f46d8d3023aa64104a350e0 to your computer and use it in GitHub Desktop.

Circuit Breaker Queue API — Enriched Response

Endpoint

GET /status/ftusd/circuit-breaker/queue?address=0x...&chainId=146

What Changed

The response outflows array now returns enriched objects instead of raw on-chain data. Each outflow includes action classification, token details, and claimable status.

New Response Shape

{
  "success": true,
  "outflows": [
    {
      "queueId": 42,
      "action": "buy",               // "buy" | "buyAndStake" | "unstake" | "redeem" | "unknown"
      "fromToken": {
        "address": "0xabc...def",     // lowercase checksummed
        "symbol": "USDC.e",
        "decimals": 6
      },
      "fromAmount": "1000000000",     // raw amount (use fromToken.decimals to format)
      "fromAmountFormatted": "1.00K", // human-readable (K/M/B)
      "toToken": {
        "address": "0x123...456",
        "symbol": "ftUSD",
        "decimals": 6
      },
      "toAmount": "999500000",
      "toAmountFormatted": "999.5000",
      "recipient": "0xUserAddress",
      "queuedAt": 1708300000,         // unix timestamp
      "settlesAt": 1708303600,        // unix timestamp
      "status": "pending",            // "pending" | "executed" | "paused"
      "timeUntilSettled": 3600,       // seconds remaining (0 if settled)
      "claimable": false,             // true when status=pending AND settlesAt <= block.timestamp
      "transactionHash": "0xabc..."   // tx that triggered the queue (empty if DB unavailable)
    }
  ]
}

Action Types

Action Meaning From Token To Token
buy User minted ftUSD with collateral Collateral (USDC.e, etc.) ftUSD
buyAndStake User minted + staked in one tx Collateral sftUSD
unstake User unstaked sftUSD → ftUSD sftUSD ftUSD
redeem User redeemed ftUSD for collateral ftUSD Collateral
unknown Could not determine (DB unavailable or unexpected token) May be empty Outflow token

UI Mapping

For the queue table columns:

Column Field
Action action
From Token fromToken.symbol
From Amount fromAmountFormatted (or format fromAmount with fromToken.decimals yourself)
To Token toToken.symbol
To Amount toAmountFormatted
Timer timeUntilSettled (seconds countdown, 0 = settled)
Claimable claimable (boolean — show claim button when true)
Tx Link transactionHash (link to block explorer)

Claimable Logic

claimable = (status === "pending") && (settlesAt <= currentBlockTimestamp)

When claimable is true, the user can call executeQueuedOutflow(queueId) on the CircuitBreakerV2 contract.

Graceful Degradation

  • If the backend DB is unavailable, action will be "unknown" and transactionHash will be empty
  • fromToken/toToken may have empty symbol if the token is unrecognized
  • fromAmount/toAmount fall back to the on-chain outflow amount when DB enrichment fails

Old Fields Removed

The following fields from the previous response are no longer present:

  • token → replaced by fromToken + toToken
  • amount / amountFormatted → replaced by fromAmount/toAmount + formatted variants
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment