Raxol.Payments.SettlementAccountant (Raxol Payments v0.2.0)

Copy Markdown View Source

Subscribes to [:raxol, :payments, :xochi, :settled] and books each completed settlement into a Raxol.Payments.SettlementLedger.

The telemetry handler runs in the settling process, so it does no IO -- it casts to this GenServer, which does the receipt fetch (via ChainReader) and the ledger write off the settlement hot path. A not-yet-mined receipt is recorded as :pending (record_pending: true) and backfilled later by SettlementLedger.amend_gas/4.

Started by a host supervisor (e.g. Raxol.ACP.Supervisor), like Ledger -- raxol_payments has no supervision tree of its own.

Options

  • :ledger -- the SettlementLedger server (name or pid). Required.
  • :reader -- a ChainReader.reader. Defaults to a ChainReader.JSONRPC built from :rpc_urls or config :raxol_payments, :accounting, rpc_urls:.
  • :name, :handler_id, :record_opts (default [record_pending: true]).

Summary

Functions

Returns a specification to start this module under a supervisor.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

start_link(opts)

@spec start_link(keyword()) :: GenServer.on_start()