From a524f6595b194ec84eaec21cffe6a05c0423e5eb Mon Sep 17 00:00:00 2001 From: KOSASIH Date: Sun, 20 Oct 2024 11:35:50 +0700 Subject: [PATCH] Create RollupManager.sol --- .../contracts/rollups/RollupManager.sol | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 blockchain_integration/pi_network/pi-network-layer2-scaling/contracts/rollups/RollupManager.sol diff --git a/blockchain_integration/pi_network/pi-network-layer2-scaling/contracts/rollups/RollupManager.sol b/blockchain_integration/pi_network/pi-network-layer2-scaling/contracts/rollups/RollupManager.sol new file mode 100644 index 000000000..cea6cddc1 --- /dev/null +++ b/blockchain_integration/pi_network/pi-network-layer2-scaling/contracts/rollups/RollupManager.sol @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +contract RollupManager { + mapping(address => bool) public operators; + address public owner; + + event OperatorAdded(address indexed operator); + event OperatorRemoved(address indexed operator); + + modifier onlyOwner() { + require(msg.sender == owner, "Not the owner"); + _; + } + + constructor() { + owner = msg.sender; + } + + function addOperator(address _operator) external onlyOwner { + require(!operators[_operator], "Already an operator"); + operators[_operator] = true; + emit OperatorAdded(_operator); + } + + function removeOperator(address _operator) external onlyOwner { + require(operators[_operator], "Not an operator"); + operators[_operator] = false; + emit OperatorRemoved(_operator); + } + + function isOperator(address _address) external view returns (bool) { + return operators[_address]; + } +}