Skip to content

sgns::BridgeRelayer

Registers both BridgeSourceBurned (v1) and BridgeOutInitiated (v2) watches on a shared EthWatchService across multiple chains and calls MintFunds when burns are detected. OnWatchEvent dispatches on the variant type of values[5] to handle both event formats (D-06).

#include <BridgeRelayer.hpp>

Inherits from sgns::IBridgeInitObserver, std::enable_shared_from_this< BridgeRelayer >

Public Functions

Name
std::shared_ptr< BridgeRelayer > Create(std::weak_ptr< TransactionManager > tx_manager, std::shared_ptr< eth::EthWatchService > watch_service)
Factory method to create a BridgeRelayer instance with weak TransactionManager reference.
void Start(std::vector< ChainContractPair > chains)
Register both v1 (BridgeSourceBurned) and v2 (BridgeOutInitiated) watches on all provided chains.
virtual void OnRpcEndpointsReady(std::vector< ChainContractPair > chains) override
IBridgeInitObserver callback — self-starts when the provider signals readiness.
void Stop()
Stop watching (currently a no-op — EthWatchService lifecycle is external).

Friends

Name
class ::BridgeRelayerTestAccess
Friend accessor for unit testing OnWatchEvent and chain_watches_.

Additional inherited members

Public Functions inherited from sgns::IBridgeInitObserver

Name
virtual ~IBridgeInitObserver() =default

Public Functions Documentation

function Create

static std::shared_ptr< BridgeRelayer > Create(
    std::weak_ptr< TransactionManager > tx_manager,
    std::shared_ptr< eth::EthWatchService > watch_service
)

Factory method to create a BridgeRelayer instance with weak TransactionManager reference.

Parameters:

  • tx_manager Weak pointer to the TransactionManager to call MintFunds on.
  • watch_service Shared EthWatchService for event detection.

Return: If successful, a shared pointer to the created BridgeRelayer; otherwise, a nullptr

function Start

void Start(
    std::vector< ChainContractPair > chains
)

Register both v1 (BridgeSourceBurned) and v2 (BridgeOutInitiated) watches on all provided chains.

Parameters:

  • chains Vector of (chain_name, contract_address) pairs. Chains without a valid contract address are skipped with a warning. Best-effort: if one event/chain fails, others still register (D-21).

function OnRpcEndpointsReady

virtual void OnRpcEndpointsReady(
    std::vector< ChainContractPair > chains
) override

IBridgeInitObserver callback — self-starts when the provider signals readiness.

Parameters:

  • chains List of (chain_name, contract_address, chain_id) pairs.

Reimplements: sgns::IBridgeInitObserver::OnRpcEndpointsReady

function Stop

void Stop()

Stop watching (currently a no-op — EthWatchService lifecycle is external).

Friends

friend ::BridgeRelayerTestAccess

friend class ::BridgeRelayerTestAccess(
    ::BridgeRelayerTestAccess 
);

Friend accessor for unit testing OnWatchEvent and chain_watches_.


Updated on 2026-06-28 at 18:54:57 -0700