Contract detail
OperatingModeFacet
OperatingModeFacet is a verified Robinhood Chain smart contract at 0x5cc490d3…b405bfee with 0 indexed transactions.
- Address type
- Smart contract
- Transactions
- 0
- History coverage
- No indexed activity found
- Verification
- Verified
- Compiler
- v0.8.24+commit.e11b9ed9
- Verification match
- partial
- Creation transaction
- 0x77ceeb04…0268a51a
- Created at block
- #28614976
- Language
- solidity
- EVM version
- cancun
- License
- none
- Compiler optimization
- Enabled · 200 runs
Verified contract
Contract source code
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
import {AppStorage, OperatingMode, ADMIN_ROLE, GUARD_ROLE} from "../libs/LibAppStorage.sol";
import {RoleGuard} from "../shared/RoleGuard.sol";
// ═══════════════════════════════════════════════════════════════════════════════
// EVENTS
// ═══════════════════════════════════════════════════════════════════════════════
event OperatingModeChanged(OperatingMode indexed oldMode, OperatingMode indexed newMode, address indexed changedBy);
// ═══════════════════════════════════════════════════════════════════════════════
// FACET
// ═══════════════════════════════════════════════════════════════════════════════
/// @title OperatingModeFacet
/// @notice Manages bridge operating mode (Normal vs Guarded)
/// @dev Normal mode allows instant path for trusted/small transactions.
/// Guarded mode queues all transactions through timelock.
contract OperatingModeFacet is RoleGuard {
// =========================================================================
// Storage
// =========================================================================
/// @dev AppStorage at slot 0 - MUST be the only state variable
AppStorage internal s;
// =========================================================================
// External Functions
// =========================================================================
/// @notice Enter guarded mode - all bridge-in transactions will be queued
/// @dev Requires GUARD_ROLE. Idempotent (no-op if already guarded).
/// @return changed True if mode was changed, false if already in Guarded mode
function enterGuardedMode() external onlyRole(GUARD_ROLE) returns (bool changed) {
OperatingMode oldMode = s.operatingMode;
if (oldMode == OperatingMode.Guarded) {
return false;
}
s.operatingMode = OperatingMode.Guarded;
emit OperatingModeChanged(oldMode, OperatingMode.Guarded, msg.sender);
return true;
}
/// @notice Enter normal mode - instant path available for eligible transactions
/// @dev Can only be called by ADMIN role. Idempotent (no-op if already normal).
/// @return changed True if mode was changed, false if already in Normal mode
function enterNormalMode() external onlyRole(ADMIN_ROLE) returns (bool changed) {
OperatingMode oldMode = s.operatingMode;
if (oldMode == OperatingMode.Normal) {
return false;
}
s.operatingMode = OperatingMode.Normal;
emit OperatingModeChanged(oldMode, OperatingMode.Normal, msg.sender);
return true;
}
/// @notice Get the current operating mode
/// @return The current operating mode (Normal or Guarded)
function getOperatingMode() external view returns (OperatingMode) {
return s.operatingMode;
}
}