diff --git a/evm/src/NttManager/NttManager.sol b/evm/src/NttManager/NttManager.sol index 7ac021b91..8ca575999 100644 --- a/evm/src/NttManager/NttManager.sol +++ b/evm/src/NttManager/NttManager.sol @@ -256,7 +256,9 @@ contract NttManager is INttManager, RateLimiter, ManagerBase { sourceChainId, sourceNttManagerAddress, message.id, message.sender, nativeTokenTransfer ); - _mintOrUnlockToRecipient(digest, transferRecipient, nativeTransferAmount, false); + _mintOrUnlockToRecipient( + sourceChainId, digest, transferRecipient, nativeTransferAmount, false + ); } /// @dev Override this function to process an additional payload on the NativeTokenTransfer @@ -284,7 +286,7 @@ contract NttManager is INttManager, RateLimiter, ManagerBase { bool isRateLimited = _isInboundAmountRateLimited(nativeTransferAmount, sourceChainId); if (isRateLimited) { // queue up the transfer - _enqueueInboundTransfer(digest, nativeTransferAmount, transferRecipient); + _enqueueInboundTransfer(sourceChainId, digest, nativeTransferAmount, transferRecipient); // end execution early return true; @@ -317,7 +319,13 @@ contract NttManager is INttManager, RateLimiter, ManagerBase { delete _getInboundQueueStorage()[digest]; // run it through the mint/unlock logic - _mintOrUnlockToRecipient(digest, queuedTransfer.recipient, queuedTransfer.amount, false); + _mintOrUnlockToRecipient( + queuedTransfer.sourceChain, + digest, + queuedTransfer.recipient, + queuedTransfer.amount, + false + ); } /// @inheritdoc INttManager @@ -370,7 +378,11 @@ contract NttManager is INttManager, RateLimiter, ManagerBase { // return the queued funds to the sender _mintOrUnlockToRecipient( - bytes32(uint256(messageSequence)), msg.sender, queuedTransfer.amount, true + queuedTransfer.sourceChain, + bytes32(uint256(messageSequence)), + msg.sender, + queuedTransfer.amount, + true ); } @@ -494,6 +506,7 @@ contract NttManager is INttManager, RateLimiter, ManagerBase { // queue up and return _enqueueOutboundTransfer( + chainId, sequence, trimmedAmount, recipientChain, @@ -611,6 +624,7 @@ contract NttManager is INttManager, RateLimiter, ManagerBase { } function _mintOrUnlockToRecipient( + uint16 sourceChain, bytes32 digest, address recipient, TrimmedAmount amount, @@ -626,7 +640,7 @@ contract NttManager is INttManager, RateLimiter, ManagerBase { if (cancelled) { emit OutboundTransferCancelled(uint256(digest), recipient, untrimmedAmount); } else { - emit TransferRedeemed(digest); + emit TransferRedeemed(sourceChain, digest); } if (mode == Mode.LOCKING) { diff --git a/evm/src/interfaces/IRateLimiter.sol b/evm/src/interfaces/IRateLimiter.sol index 05aec9751..31741ed99 100644 --- a/evm/src/interfaces/IRateLimiter.sol +++ b/evm/src/interfaces/IRateLimiter.sol @@ -57,6 +57,7 @@ interface IRateLimiter { /// @notice Parameters for an outbound queued transfer. /// @dev + /// - sourceChain: the chain of the sender. /// - recipient: the recipient of the transfer. /// - amount: the amount of the transfer, trimmed. /// - txTimestamp: the timestamp of the transfer. @@ -64,6 +65,7 @@ interface IRateLimiter { /// - sender: the sender of the transfer. /// - transceiverInstructions: additional instructions to be forwarded to the recipient chain. struct OutboundQueuedTransfer { + uint16 sourceChain; bytes32 recipient; bytes32 refundAddress; TrimmedAmount amount; @@ -75,10 +77,12 @@ interface IRateLimiter { /// @notice Parameters for an inbound queued transfer. /// @dev + /// - sourceChain: the chain of the sender. /// - amount: the amount of the transfer, trimmed. /// - txTimestamp: the timestamp of the transfer. /// - recipient: the recipient of the transfer. struct InboundQueuedTransfer { + uint16 sourceChain; TrimmedAmount amount; uint64 txTimestamp; address recipient; diff --git a/evm/src/libraries/RateLimiter.sol b/evm/src/libraries/RateLimiter.sol index 2543c542f..45e2ab1b7 100644 --- a/evm/src/libraries/RateLimiter.sol +++ b/evm/src/libraries/RateLimiter.sol @@ -286,6 +286,7 @@ abstract contract RateLimiter is IRateLimiter, IRateLimiterEvents { } function _enqueueOutboundTransfer( + uint16 sourceChain, uint64 sequence, TrimmedAmount amount, uint16 recipientChain, @@ -295,6 +296,7 @@ abstract contract RateLimiter is IRateLimiter, IRateLimiterEvents { bytes memory transceiverInstructions ) internal { _getOutboundQueueStorage()[sequence] = OutboundQueuedTransfer({ + sourceChain: sourceChain, amount: amount, recipientChain: recipientChain, recipient: recipient, @@ -308,11 +310,13 @@ abstract contract RateLimiter is IRateLimiter, IRateLimiterEvents { } function _enqueueInboundTransfer( + uint16 sourceChain, bytes32 digest, TrimmedAmount amount, address recipient ) internal { _getInboundQueueStorage()[digest] = InboundQueuedTransfer({ + sourceChain: sourceChain, amount: amount, recipient: recipient, txTimestamp: uint64(block.timestamp)