unrip/src/core/liquidity-state.mjs
philipp 860471f267
Some checks failed
deploy / deploy (push) Failing after 2s
Add pre-credit funding visibility and durable alerts
Proof: Implement the active turn for pre-credit funding visibility and durable operator alerts while keeping spendable inventory truth limited to bridge/verifier credit.

Assumptions: The BTC deposit handle can be observed through a mempool.space-compatible API, bridge recent_deposits remains the credit truth for correlation, and pausing market-reference-ingest or inventory-sync briefly for alert validation is safe without disarming strategy or executor.

Still fake: Gnosis pre-credit observation is not implemented, executor failure alert validation may still depend on an existing real failure unless a separate live failure is explicitly approved, and a new live deposit is still required to prove a fresh pre-credit-to-credit path if no suitable recent funding exists.
2026-04-03 17:50:39 +02:00

18 lines
648 B
JavaScript

export function normalizeLiquidityState(state, { withdrawalsFrozen }) {
state.deposit_addresses ||= {};
state.deposits ||= {};
state.tracked_withdrawals ||= {};
state.supported_tokens ||= {};
state.funding_observations ||= {};
state.funding_observations_by_handle ||= {};
state.funding_visibility_by_asset ||= {};
state.uncredited_funding_total_by_asset ||= {};
state.credit_correlation ||= {};
state.observer_health ||= {};
state.publish_count ||= 0;
state.funding_publish_count ||= 0;
state.withdrawals_frozen ??= withdrawalsFrozen;
state.paused ??= false;
state.funding_observer_paused ??= false;
return state;
}