soroban_tools/oracle/
impl.rs1use soroban_sdk::{contracttype, Address, Env, IntoVal, TryFromVal, Val, Vec};
14
15pub trait Events<T, V>
17where
18 T: Clone + IntoVal<Env, Val> + TryFromVal<Env, Val>,
19 V: Clone + IntoVal<Env, Val> + TryFromVal<Env, Val>,
20{
21 fn on_request(_env: &Env, _topic: &T, _envelope: &Envelope) {}
22 fn on_sync_receive(_env: &Env, _topic: &T, _envelope: &Envelope, _data: &V) {}
23 fn on_async_receive(_env: &Env, _topic: &T, _envelope: &Envelope, _data: &V) {}
24 fn on_subscribe(_env: &Env, _topic: &T, _envelope: &Envelope) -> Option<V> {
25 None
26 }
27 fn on_publish(env: &Env, _topic: &T, _data: &V, _publisher: &Address) -> Vec<Envelope> {
28 Vec::<Envelope>::new(env)
29 }
30}
31
32#[contracttype]
34#[derive(Clone, Debug, Eq, PartialEq)]
35pub struct Envelope {
36 pub subscriber: Address,
37 pub broker: Address,
38 pub router: Address,
39}