Перейти к содержимому
Проверенный контрактТочноеMIT

ConfigSetSystem

Адрес0xd4035ceaf2695d99b2bed0c9e01c1952be39efec
Баланс

0 ETH

 

Транзакций

0

 

Компилятор

solc 0.8.24

 

Тот же код

Только этот контракт

 

Подробности

Компилятор
solc 0.8.24+commit.e11b9ed9
Язык
solidity
Оптимизация
Да, 3 000 прогонов
Версия EVM
cancun
Через IR
да
Лицензия
MIT
Совпадение
Точноекод создания: да, код в сети: да
Проверен на Sourcify
Создан в блоке
25 481 290
Транзакция создания
0x530946fe3a…40b5774ab0

74 файла

Исходный код большой: показывается один файл. Выберите файл в списке.

src/namespaces/app/ConfigSetSystem.sol

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.24;

import { System } from "@latticexyz/world/src/System.sol";

import { LibConfig } from "libraries/utils/LibConfig.sol";
import { LibAuthRoles, Role } from "libraries/utils/LibAuthRoles.sol";
import { LibOnyx } from "libraries/LibOnyx.sol";

/// @notice System for setting global config values (admin-only)
contract ConfigSetSystem is System {
  //////////////////
  // BASIC SETTERS

  /// @notice Set a uint256 config value
  function setConfig(string memory field, uint256 value) public {
    LibAuthRoles.verifyRole(_msgSender(), Role.ADMIN);
    _requireNotTeamWallet(field);
    LibConfig.set(field, value);
  }

  /// @notice Set an address config value
  function setConfigAddress(string memory field, address value) public {
    LibAuthRoles.verifyRole(_msgSender(), Role.ADMIN);
    _requireNotTeamWallet(field);
    LibConfig.setAddress(field, value);
  }

  /// @notice Set a bool config value
  function setConfigBool(string memory field, bool value) public {
    LibAuthRoles.verifyRole(_msgSender(), Role.ADMIN);
    _requireNotTeamWallet(field);
    LibConfig.setBool(field, value);
  }

  /// @notice Set a string config value (max 31 characters)
  function setConfigString(string memory field, string memory value) public {
    LibAuthRoles.verifyRole(_msgSender(), Role.ADMIN);
    _requireNotTeamWallet(field);
    LibConfig.setString(field, value);
  }

  /// @notice Set an array config value (uint32[8])
  function setConfigArray(string memory field, uint32[8] memory values) public {
    LibAuthRoles.verifyRole(_msgSender(), Role.ADMIN);
    _requireNotTeamWallet(field);
    LibConfig.setArray(field, values);
  }

  /// @dev onyx.teamWallet is a fund-routing address: every generic setter here writes the same
  ///      Config slot (LibConfig keys all setters by nameToKey(field)), so all of them must refuse
  ///      it. It moves only through OnyxAdminSystem.setTeamWallet (non-zero guard + TeamWalletUpdated
  ///      event), so monitoring can rely on the event and the slot can't be zeroed/mistyped.
  function _requireNotTeamWallet(string memory field) private pure {
    require(
      LibConfig.nameToKey(field) != LibOnyx.HASH_TEAM_WALLET,
      "ConfigSetSystem: set onyx.teamWallet via OnyxAdminSystem.setTeamWallet"
    );
  }
}
Настройки компилятораПоказать
{
  "viaIR": true,
  "metadata": {
    "appendCBOR": true,
    "bytecodeHash": "ipfs",
    "useLiteralContent": false
  },
  "optimizer": {
    "runs": 3000,
    "enabled": true
  },
  "evmVersion": "cancun",
  "remappings": [
    "forge-std/=node_modules/forge-std/src/",
    "@latticexyz/=node_modules/@latticexyz/",
    "@openzeppelin/=node_modules/@openzeppelin/",
    "solady/=node_modules/solady/src/",
    "libraries/=src/namespaces/app/libraries/",
    "tables/=src/namespaces/app/codegen/tables/",
    "common/=src/codegen/"
  ]
}

Исходный код и метаданные: Sourcify.

Исходный код принадлежит авторам контракта.