Trait chaindexing::SideEffectHandler
source · pub trait SideEffectHandler: Send + Sync {
type SharedState: Send + Sync + Clone + Debug;
// Required methods
fn abi(&self) -> &'static str;
fn handle_event<'a, 'life0, 'async_trait>(
&'life0 self,
context: SideEffectHandlerContext<'a, Self::SharedState>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'a: 'async_trait,
'life0: 'async_trait;
}
Expand description
SideEffectHandlers are event handlers that help handle side-effects for events.
This is useful for handling events only ONCE and can rely on a non-deterministic
shared state. Some use-cases are notifications, bridging etc. Chaindexing ensures
that the side-effect handlers are called once immutably regardless of resets.
However, one can dangerously reset including side effects with the reset_including_side_effects
exposed in the Config API.
Required Associated Types§
Required Methods§
sourcefn abi(&self) -> &'static str
fn abi(&self) -> &'static str
The human-readable ABI of the event being handled.
For example, Uniswap’s PoolCreated event’s abi is:
PoolCreated(address indexed token0, address indexed token1, uint24 indexed fee, int24 tickSpacing, address pool)
.
The chain explorer’s event section can also be used to infer this.