Skip to content

Commit

Permalink
add useful event info
Browse files Browse the repository at this point in the history
  • Loading branch information
Rahul Maganti authored and RahulMaganti47 committed Feb 26, 2024
1 parent bdc8a23 commit c4a3737
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion evm/src/NttManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ contract NttManager is
recipientChain, priceQuotes, instructions, enabledTransceivers, encodedNttManagerPayload
);

emit TransferSent(recipient, _nttUntrim(amount), recipientChain, seq);
emit TransferSent(recipient, _nttUntrim(amount), msg.value, recipientChain, seq);

// return the sequence number
return sequence;
Expand Down
11 changes: 11 additions & 0 deletions evm/src/WormholeTransceiver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ contract WormholeTransceiver is Transceiver, IWormholeTransceiver, IWormholeRece
bool shouldSkipRelayerSend;
}

enum RelayingType {
Standard,
Special,
Manual
}

/// =============== STORAGE ===============================================

bytes32 private constant WORMHOLE_CONSUMED_VAAS_SLOT =
Expand Down Expand Up @@ -216,14 +222,19 @@ contract WormholeTransceiver is Transceiver, IWormholeTransceiver, IWormholeRece
0,
GAS_LIMIT
);

emit RelayingInfo(uint8(RelayingType.Standard), deliveryPayment);
} else if (!weIns.shouldSkipRelayerSend && isSpecialRelayingEnabled(recipientChain)) {
uint64 sequence =
wormhole.publishMessage(0, encodedTransceiverPayload, consistencyLevel);
specialRelayer.requestDelivery{value: deliveryPayment}(
getNttManagerToken(), recipientChain, 0, sequence
);

emit RelayingInfo(uint8(RelayingType.Special), deliveryPayment);
} else {
wormhole.publishMessage(0, encodedTransceiverPayload, consistencyLevel);
emit RelayingInfo(uint8(RelayingType.Manual), deliveryPayment);
}

emit SendTransceiverMessage(recipientChain, transceiverMessage);
Expand Down
7 changes: 4 additions & 3 deletions evm/src/interfaces/INttManagerEvents.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import "../libraries/TrimmedAmount.sol";
interface INttManagerEvents {
/// @notice Emitted when a message is sent from the nttManager.
/// @dev Topic0
/// 0x71ec1d4b53baa86365b6523ea136c9fe0f72c36c721e7e28e9efac2c23b39d98.
/// 0x9716fe52fe4e02cf924ae28f19f5748ef59877c6496041b986fbad3dae6a8ecf
/// @param recipient The recipient of the message.
/// @param amount The amount transferred.
/// @param fee The amount of ether sent along with the tx to cover the delivery fee.
/// @param recipientChain The chain ID of the recipient.
/// @param msgSequence The unique sequence ID of the message.
event TransferSent(
bytes32 recipient, uint256 amount, uint16 recipientChain, uint64 msgSequence
bytes32 recipient, uint256 amount, uint256 fee, uint16 recipientChain, uint64 msgSequence
);

/// @notice Emitted when the peer contract is updated.
Expand Down Expand Up @@ -66,5 +67,5 @@ interface INttManagerEvents {
/// @dev Topic0
/// 0x504e6efe18ab9eed10dc6501a417f5b12a2f7f2b1593aed9b89f9bce3cf29a91.
/// @param digest The digest of the message.
event TransferRedeemed(bytes32 digest);
event TransferRedeemed(bytes32 indexed digest);
}
1 change: 1 addition & 0 deletions evm/src/interfaces/IWormholeTransceiver.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface IWormholeTransceiver {
event SendTransceiverMessage(
uint16 recipientChain, TransceiverStructs.TransceiverMessage message
);
event RelayingInfo(uint8 relayingType, uint256 deliveryPayment);
event SetWormholePeer(uint16 chainId, bytes32 peerContract);
event SetIsWormholeRelayingEnabled(uint16 chainId, bool isRelayingEnabled);
event SetIsSpecialRelayingEnabled(uint16 chainId, bool isRelayingEnabled);
Expand Down

0 comments on commit c4a3737

Please sign in to comment.