Skip to content

Commit

Permalink
Merge pull request #2311 from dusk-network/memo-events
Browse files Browse the repository at this point in the history
Add memo to transaction events
  • Loading branch information
Eduardo Leegwater Simões authored Sep 9, 2024
2 parents bb0b836 + 0d1a33b commit 67a6a08
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions contracts/transfer/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,11 @@ impl TransferState {
_ => None,
};

let mut memo = Vec::new();
if let Some(m) = ongoing.tx.memo() {
memo = m.to_vec();
}

// in phoenix, a refund note is with the unspent amount to the stealth
// address in the `Fee` structure, while in moonlight we simply refund
// the `from` account for what it didn't spend
Expand Down Expand Up @@ -650,6 +655,7 @@ impl TransferState {
PhoenixTransactionEvent {
nullifiers: tx.nullifiers().to_vec(),
notes,
memo,
gas_spent,
},
);
Expand All @@ -673,6 +679,7 @@ impl TransferState {
from: *tx.from_account(),
to: tx.to_account().copied(),
value: tx.value(),
memo,
gas_spent,
},
);
Expand Down
4 changes: 4 additions & 0 deletions execution-core/src/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,8 @@ pub struct PhoenixTransactionEvent {
pub nullifiers: Vec<BlsScalar>,
/// Notes produced during the transaction.
pub notes: Vec<Note>,
/// The memo included in the transaction.
pub memo: Vec<u8>,
/// Gas spent by the transaction.
pub gas_spent: u64,
}
Expand All @@ -483,6 +485,8 @@ pub struct MoonlightTransactionEvent {
pub to: Option<AccountPublicKey>,
/// Transfer amount
pub value: u64,
/// The memo included in the transaction.
pub memo: Vec<u8>,
/// Gas spent by the transaction.
pub gas_spent: u64,
}

0 comments on commit 67a6a08

Please sign in to comment.