Blockchain / Global / Address
Contract
0x19F8CFdeb913a52ec02ebefd30596B84e8Ddde5B
- Balance
- 0 SOMI
- Transactions sent
- 1
- Type
- Contract · 58 bytes of code
LibController Verified
- Compiler
- solc 0.8.27+commit.40a35a09
- Language
- Solidity
- Optimization
- Yes, 200 runs
- EVM version
- paris
- License
- —
- Verified
- 2026-10-12
contracts/libraries/LibController.sol
Solidity
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.24;
library LibController {
bytes32 constant DIAMOND_STORAGE_POSITION =
keccak256("diamond.standard.controller.storage");
enum OperatorManage {
Add,
Remove
}
struct DiamondStorage {
mapping(address => bool) operators;
address admin;
bool paused;
bool isEmergencyModeActive;
address newOwner;
uint256[10] __gap;
}
function diamondStorage() internal pure returns (DiamondStorage storage ds) {
bytes32 position = DIAMOND_STORAGE_POSITION;
assembly {
ds.slot := position
}
}
event AdminTransferred(
address indexed previousAdmin,
address indexed newAdmin
);
function setAdmin(address _newAdmin) internal {
DiamondStorage storage ds = diamondStorage();
address previousAdmin = ds.admin;
ds.admin = _newAdmin;
emit AdminTransferred(previousAdmin, _newAdmin);
}
function admin() internal view returns (address admin_) {
admin_ = diamondStorage().admin;
}
function enforceIsAdmin() internal view {
require(
msg.sender == diamondStorage().admin,
"LibController: Must be admin"
);
}
event OperatorsUpdated(address indexed operator, OperatorManage action);
function addOperator(address _newOperator) internal {
DiamondStorage storage ds = diamondStorage();
require(!ds.operators[_newOperator], "Operator exists");
ds.operators[_newOperator] = true;
emit OperatorsUpdated(_newOperator, OperatorManage.Add);
}
function removeOperator(address toRemove) internal {
DiamondStorage storage ds = diamondStorage();
require(ds.operators[toRemove], "Operator not exists");
ds.operators[toRemove] = false;
emit OperatorsUpdated(toRemove, OperatorManage.Remove);
}
function enforceIsOperator(address target) internal view {
require(
diamondStorage().operators[target],
"LibController: Must be operator"
);
}
function isOperator(address target) internal view returns (bool) {
return diamondStorage().operators[target];
}
function activateEmergencyMode() internal {
DiamondStorage storage ds = diamondStorage();
require(!ds.isEmergencyModeActive, "Emergency mode is already activated");
ds.isEmergencyModeActive = true;
}
function deactivateEmergencyMode() internal {
DiamondStorage storage ds = diamondStorage();
require(ds.isEmergencyModeActive, "Emergency mode is not activated");
ds.isEmergencyModeActive = false;
}
function isEmergencyModeActive() internal view returns (bool) {
return diamondStorage().isEmergencyModeActive;
}
}
ABI · 2 entries
json
[
{
"name": "AdminTransferred",
"type": "event",
"inputs": [
{
"name": "previousAdmin",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "newAdmin",
"type": "address",
"indexed": true,
"internalType": "address"
}
],
"anonymous": false
},
{
"name": "OperatorsUpdated",
"type": "event",
"inputs": [
{
"name": "operator",
"type": "address",
"indexed": true,
"internalType": "address"
},
{
"name": "action",
"type": "uint8",
"indexed": false,
"internalType": "enum LibController.OperatorManage"
}
],
"anonymous": false
}
]