Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
feat: add unique id for sendToken tx
Browse files Browse the repository at this point in the history
Signed-off-by: Jawad Tariq <[email protected]>
  • Loading branch information
JDawg287 committed Feb 15, 2024
1 parent d64e219 commit 40e8972
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion contracts/interfaces/IToposCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ interface IToposCore {

event CertStored(CertificateId certId, bytes32 receiptRoot);

event CrossSubnetMessageSent(SubnetId indexed targetSubnetId);
event CrossSubnetMessageSent(SubnetId indexed targetSubnetId, SubnetId sourceSubnetId, uint256 nonce);

event Upgraded(address indexed implementation);

Expand Down
7 changes: 6 additions & 1 deletion contracts/topos-core/ToposCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ contract ToposCore is IToposCore, AdminMultisigBase, Initializable {
/// @notice The subnet ID of the subnet this contract is to be deployed on
SubnetId public networkSubnetId;

/// @notice Nonce for cross subnet message, meant to be used in combination with `sourceSubnetId`
/// so that the message can be uniquely identified per subnet
uint256 private nonce;

/// @notice Set of certificate IDs
Bytes32SetsLib.Set certificateSet;

Expand Down Expand Up @@ -113,7 +117,8 @@ contract ToposCore is IToposCore, AdminMultisigBase, Initializable {
/// @notice Emits an event to signal a cross subnet message has been sent
/// @param targetSubnetId The subnet ID of the target subnet
function emitCrossSubnetMessage(SubnetId targetSubnetId) external {
emit CrossSubnetMessageSent(targetSubnetId);
nonce += 1;
emit CrossSubnetMessageSent(targetSubnetId, networkSubnetId, nonce);
}

/// @notice Returns the admin epoch
Expand Down

0 comments on commit 40e8972

Please sign in to comment.