Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ soroban-sdk = { version = "22.0.7", features = ["testutils"] }
testutils = ["soroban-sdk/testutils"]

[lib]
crate-type = ["cdylib", "rlib"]
crate-type = ["cdylib", "rlib"]
26 changes: 23 additions & 3 deletions src/escrow.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![no_std]

use core::fmt::Write;
use heapless::String as HString;
use soroban_sdk::{
Expand Down Expand Up @@ -113,6 +115,16 @@ impl EscrowContract {
status: EscrowStatus::Active,
};

crate::event::EventEmitter::emit_escrow_created(
&env,
id.clone(),
sender.clone(),
recipient.clone(),
token.clone(),
amount,
timeout_duration,
);

// Save the escrow
env.storage().instance().set(&id, &escrow);

Expand Down Expand Up @@ -150,6 +162,16 @@ impl EscrowContract {
&escrow.amount,
);

// Emit escrow release event
crate::event::EventEmitter::emit_escrow_released(
&env,
escrow_id.clone(),
escrow.sender.clone(),
escrow.recipient.clone(),
escrow.token.clone(),
escrow.amount,
);

// Update the escrow status
let updated_escrow = EscrowConfig {
status: EscrowStatus::Released,
Expand Down Expand Up @@ -284,7 +306,6 @@ impl EscrowContract {
.get(&ESCROW_COUNT_KEY)
.unwrap_or(0u32);
let mut escrows = Vec::new(&env);

for i in 0..count {
let mut s: HString<12> = HString::new();
s.push_str("escrow_").unwrap();
Expand All @@ -304,7 +325,6 @@ impl EscrowContract {
});
}
}

escrows
}
}
}
Loading
Loading