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. |
| outcome::result< BurnEventParams > | ParseBurnEventValues(const std::vector< eth::abi::AbiValue > & values) Parse decoded ABI values into BurnEventParams for bridging. |
| 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 ParseBurnEventValues¶
static outcome::result< BurnEventParams > ParseBurnEventValues(
const std::vector< eth::abi::AbiValue > & values
)
Parse decoded ABI values into BurnEventParams for bridging.
Parameters:
- values Decoded ABI values in declaration order.
Return: Parsed parameters on success, or error if values are malformed.
Works for both OnWatchEvent (decoded via decode_log) and catch-up scan (decoded via decode_log). values layout: [0] sender (address, indexed) [3] srcChainID (uint256) [1] id (uint256) [4] destChainID (uint256) [2] amount (uint256) [5] sgnsDestination (bytes/bytes32) [6] destinationYOdd (bool, v2 only)
function Start¶
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¶
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¶
Stop watching (currently a no-op — EthWatchService lifecycle is external).
Friends¶
friend ::BridgeRelayerTestAccess¶
Friend accessor for unit testing OnWatchEvent and chain_watches_.
Updated on 2026-08-14 at 19:28:58 +0000