Skip to content
Verified contractExactMIT

ConfigSetSystem

Address0xd4035ceaf2695d99b2bed0c9e01c1952be39efec
Balance

0 ETH

 

Transactions

0

 

Compiler

solc 0.8.24

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.24+commit.e11b9ed9
Language
solidity
Optimization
Yes, 3,000 runs
EVM version
cancun
Via IR
yes
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
25,481,290
Creation transaction
0x530946fe3a…40b5774ab0

74 files

The source code is large: one file is shown at a time. Choose a file in the list.

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"
    );
  }
}
Compiler settingsShow
{
  "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/"
  ]
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.