Skip to content

Commit

Permalink
Add events for finish execute
Browse files Browse the repository at this point in the history
  • Loading branch information
CostinCarabas committed Dec 12, 2024
1 parent 4f6a6eb commit 05515ec
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 5 additions & 2 deletions bridge-proxy/src/bridge-proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
{
Expand Down Expand Up @@ -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)]
Expand Down
8 changes: 8 additions & 0 deletions bridge-proxy/src/events.rs
Original file line number Diff line number Diff line change
@@ -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);
}

0 comments on commit 05515ec

Please sign in to comment.