Skip to content

Commit 786fb78

Browse files
author
yakuhito
committed
add SwapCompleted event
1 parent a989df7 commit 786fb78

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

contracts/yakuSwap.sol

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ contract yakuSwap is Ownable {
2424
mapping (bytes32 => Swap) public swaps;
2525
uint public totalFees = 0;
2626

27+
event SwapCompleted(bytes32 indexed _swapId, string _secret);
28+
2729
function getSwapId(bytes32 secretHash, address fromAddress) public pure returns (bytes32) {
2830
return keccak256(abi.encodePacked(
2931
secretHash,
@@ -62,6 +64,7 @@ contract yakuSwap is Ownable {
6264
require(swap.secretHash == sha256(abi.encodePacked(_secret)));
6365

6466
swap.status = SwapStatus.Completed;
67+
emit SwapCompleted(_swapId, _secret);
6568
(bool success,) = swap.toAddress.call{value: swap.amount}("");
6669

6770
require(success);

0 commit comments

Comments
 (0)