From 05515ec2a212904b2641ebdfa3beabf766535a6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Costin=20Caraba=C8=99?= Date: Thu, 12 Dec 2024 23:07:55 +0200 Subject: [PATCH] Add events for finish execute --- bridge-proxy/src/bridge-proxy.rs | 7 +++++-- bridge-proxy/src/events.rs | 8 ++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 bridge-proxy/src/events.rs diff --git a/bridge-proxy/src/bridge-proxy.rs b/bridge-proxy/src/bridge-proxy.rs index bd40a18d..f587010c 100644 --- a/bridge-proxy/src/bridge-proxy.rs +++ b/bridge-proxy/src/bridge-proxy.rs @@ -2,6 +2,7 @@ use multiversx_sc::imports::*; pub mod config; +mod events; use sc_proxies::bridged_tokens_wrapper_proxy; use sc_proxies::esdt_safe_proxy; @@ -13,6 +14,7 @@ const DEFAULT_GAS_LIMIT_FOR_REFUND_CALLBACK: u64 = 1_000_000; // 1 million #[multiversx_sc::contract] pub trait BridgeProxyContract: config::ConfigModule + + events::EventsModule + multiversx_sc_modules::pause::PauseModule + storage_module::CommonStorageModule { @@ -106,10 +108,11 @@ pub trait BridgeProxyContract: fn execution_callback(&self, #[call_result] result: ManagedAsyncCallResult<()>, tx_id: usize) { if result.is_err() { self.add_pending_tx_to_refund(tx_id); - // TODO: add event + self.execute_generated_refund(tx_id); + } else { + self.execute_succesfully_finished(tx_id); } self.pending_transactions().remove(&tx_id); - // TODO: add event } #[endpoint(executeRefundTransaction)] diff --git a/bridge-proxy/src/events.rs b/bridge-proxy/src/events.rs new file mode 100644 index 00000000..beea9b17 --- /dev/null +++ b/bridge-proxy/src/events.rs @@ -0,0 +1,8 @@ +#[multiversx_sc::module] +pub trait EventsModule { + #[event("executeSuccesfullyFinished")] + fn execute_succesfully_finished(&self, #[indexed] tx_id: usize); + + #[event("executeGeneratedRefund")] + fn execute_generated_refund(&self, #[indexed] tx_id: usize); +}