Skip to content

Commit ad06713

Browse files
committed
evm: Propogate sourceChainId to TransferRedeemed event
1 parent 1edf766 commit ad06713

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

evm/src/NttManager/NttManager.sol

+19-5
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,9 @@ contract NttManager is INttManager, RateLimiter, ManagerBase {
256256
sourceChainId, sourceNttManagerAddress, message.id, message.sender, nativeTokenTransfer
257257
);
258258

259-
_mintOrUnlockToRecipient(digest, transferRecipient, nativeTransferAmount, false);
259+
_mintOrUnlockToRecipient(
260+
sourceChainId, digest, transferRecipient, nativeTransferAmount, false
261+
);
260262
}
261263

262264
/// @dev Override this function to process an additional payload on the NativeTokenTransfer
@@ -284,7 +286,7 @@ contract NttManager is INttManager, RateLimiter, ManagerBase {
284286
bool isRateLimited = _isInboundAmountRateLimited(nativeTransferAmount, sourceChainId);
285287
if (isRateLimited) {
286288
// queue up the transfer
287-
_enqueueInboundTransfer(digest, nativeTransferAmount, transferRecipient);
289+
_enqueueInboundTransfer(sourceChainId, digest, nativeTransferAmount, transferRecipient);
288290

289291
// end execution early
290292
return true;
@@ -317,7 +319,13 @@ contract NttManager is INttManager, RateLimiter, ManagerBase {
317319
delete _getInboundQueueStorage()[digest];
318320

319321
// run it through the mint/unlock logic
320-
_mintOrUnlockToRecipient(digest, queuedTransfer.recipient, queuedTransfer.amount, false);
322+
_mintOrUnlockToRecipient(
323+
queuedTransfer.sourceChain,
324+
digest,
325+
queuedTransfer.recipient,
326+
queuedTransfer.amount,
327+
false
328+
);
321329
}
322330

323331
/// @inheritdoc INttManager
@@ -370,7 +378,11 @@ contract NttManager is INttManager, RateLimiter, ManagerBase {
370378

371379
// return the queued funds to the sender
372380
_mintOrUnlockToRecipient(
373-
bytes32(uint256(messageSequence)), msg.sender, queuedTransfer.amount, true
381+
queuedTransfer.sourceChain,
382+
bytes32(uint256(messageSequence)),
383+
msg.sender,
384+
queuedTransfer.amount,
385+
true
374386
);
375387
}
376388

@@ -494,6 +506,7 @@ contract NttManager is INttManager, RateLimiter, ManagerBase {
494506

495507
// queue up and return
496508
_enqueueOutboundTransfer(
509+
chainId,
497510
sequence,
498511
trimmedAmount,
499512
recipientChain,
@@ -611,6 +624,7 @@ contract NttManager is INttManager, RateLimiter, ManagerBase {
611624
}
612625

613626
function _mintOrUnlockToRecipient(
627+
uint16 sourceChain,
614628
bytes32 digest,
615629
address recipient,
616630
TrimmedAmount amount,
@@ -626,7 +640,7 @@ contract NttManager is INttManager, RateLimiter, ManagerBase {
626640
if (cancelled) {
627641
emit OutboundTransferCancelled(uint256(digest), recipient, untrimmedAmount);
628642
} else {
629-
emit TransferRedeemed(digest);
643+
emit TransferRedeemed(sourceChain, digest);
630644
}
631645

632646
if (mode == Mode.LOCKING) {

evm/src/interfaces/IRateLimiter.sol

+4
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,15 @@ interface IRateLimiter {
5757

5858
/// @notice Parameters for an outbound queued transfer.
5959
/// @dev
60+
/// - sourceChain: the chain of the sender.
6061
/// - recipient: the recipient of the transfer.
6162
/// - amount: the amount of the transfer, trimmed.
6263
/// - txTimestamp: the timestamp of the transfer.
6364
/// - recipientChain: the chain of the recipient.
6465
/// - sender: the sender of the transfer.
6566
/// - transceiverInstructions: additional instructions to be forwarded to the recipient chain.
6667
struct OutboundQueuedTransfer {
68+
uint16 sourceChain;
6769
bytes32 recipient;
6870
bytes32 refundAddress;
6971
TrimmedAmount amount;
@@ -75,10 +77,12 @@ interface IRateLimiter {
7577

7678
/// @notice Parameters for an inbound queued transfer.
7779
/// @dev
80+
/// - sourceChain: the chain of the sender.
7881
/// - amount: the amount of the transfer, trimmed.
7982
/// - txTimestamp: the timestamp of the transfer.
8083
/// - recipient: the recipient of the transfer.
8184
struct InboundQueuedTransfer {
85+
uint16 sourceChain;
8286
TrimmedAmount amount;
8387
uint64 txTimestamp;
8488
address recipient;

evm/src/libraries/RateLimiter.sol

+4
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ abstract contract RateLimiter is IRateLimiter, IRateLimiterEvents {
296296
}
297297

298298
function _enqueueOutboundTransfer(
299+
uint16 sourceChain,
299300
uint64 sequence,
300301
TrimmedAmount amount,
301302
uint16 recipientChain,
@@ -305,6 +306,7 @@ abstract contract RateLimiter is IRateLimiter, IRateLimiterEvents {
305306
bytes memory transceiverInstructions
306307
) internal {
307308
_getOutboundQueueStorage()[sequence] = OutboundQueuedTransfer({
309+
sourceChain: sourceChain,
308310
amount: amount,
309311
recipientChain: recipientChain,
310312
recipient: recipient,
@@ -318,11 +320,13 @@ abstract contract RateLimiter is IRateLimiter, IRateLimiterEvents {
318320
}
319321

320322
function _enqueueInboundTransfer(
323+
uint16 sourceChain,
321324
bytes32 digest,
322325
TrimmedAmount amount,
323326
address recipient
324327
) internal {
325328
_getInboundQueueStorage()[digest] = InboundQueuedTransfer({
329+
sourceChain: sourceChain,
326330
amount: amount,
327331
recipient: recipient,
328332
txTimestamp: uint64(block.timestamp)

0 commit comments

Comments
 (0)