RSC_NonceManager

Description:

Smart contract deployed on Ethereum with Factory features.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

{{
  "language": "Solidity",
  "sources": {
    "src/RSC_NonceManager.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

import {Ownable} from "./utils/Ownable.sol";

/// @title RSC_NonceManager
/// @notice Global (srcChain, channel, messageType) nonce guard
contract RSC_NonceManager is Ownable {
    // key = keccak256(abi.encode(srcChain, channel, msgType))
    mapping(bytes32 => uint256) public nonce;
    event Consumed(bytes32 indexed key, uint256 next);

    function consume(uint32 srcChain, bytes32 channel, bytes32 msgType, uint256 expected) external onlyOwner {
        bytes32 k = keccak256(abi.encode(srcChain, channel, msgType));
        require(nonce[k] == expected, "bad-order");
        nonce[k] = expected + 1;
        emit Consumed(k, nonce[k]);
    }
}


"
    },
    "src/utils/Ownable.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

/// @title Minimal Ownable utility
abstract contract Ownable {
    error NotOwner();

    address public owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    constructor() {
        owner = msg.sender;
        emit OwnershipTransferred(address(0), msg.sender);
    }

    modifier onlyOwner() {
        if (msg.sender != owner) revert NotOwner();
        _;
    }

    function transferOwnership(address newOwner) external onlyOwner {
        require(newOwner != address(0), "Owner=zero");
        emit OwnershipTransferred(owner, newOwner);
        owner = newOwner;
    }
}


"
    }
  },
  "settings": {
    "remappings": [
      "forge-std/=lib/forge-std/src/",
      "reactive-lib/=lib/reactive-lib/src/"
    ],
    "optimizer": {
      "enabled": true,
      "runs": 200
    },
    "metadata": {
      "useLiteralContent": false,
      "bytecodeHash": "ipfs",
      "appendCBOR": true
    },
    "outputSelection": {
      "*": {
        "*": [
          "evm.bytecode",
          "evm.deployedBytecode",
          "devdoc",
          "userdoc",
          "metadata",
          "abi"
        ]
      }
    },
    "evmVersion": "cancun",
    "viaIR": true
  }
}}

Tags:
Factory|addr:0x0b3aedf8b8841799cbec50419e8b5ea44995ceec|verified:true|block:23451996|tx:0xdace66c5f621dc26a69cb46a72be97d7cc8457343122dead4a49c67b6010a5b6|first_check:1758966621

Submitted on: 2025-09-27 11:50:22

Comments

Log in to comment.

No comments yet.