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.solmain2.33 KB
- node_modules/@latticexyz/schema-type/src/solidity/SchemaType.sol3.72 KB
- node_modules/@latticexyz/store/src/Bytes.sol35.98 KB
- node_modules/@latticexyz/store/src/EncodedLengths.sol9.33 KB
- node_modules/@latticexyz/store/src/FieldLayout.sol8.62 KB
- node_modules/@latticexyz/store/src/Hook.sol3.97 KB
- node_modules/@latticexyz/store/src/IERC165.sol576 B
- node_modules/@latticexyz/store/src/IEncodedLengthsErrors.sol737 B
- node_modules/@latticexyz/store/src/IFieldLayoutErrors.sol2.26 KB
- node_modules/@latticexyz/store/src/ISchemaErrors.sol834 B
- node_modules/@latticexyz/store/src/ISliceErrors.sol894 B
- node_modules/@latticexyz/store/src/IStore.sol321 B
- node_modules/@latticexyz/store/src/IStoreErrors.sol4.12 KB
- node_modules/@latticexyz/store/src/IStoreEvents.sol2.91 KB
- node_modules/@latticexyz/store/src/IStoreHook.sol6.12 KB
- node_modules/@latticexyz/store/src/IStoreKernel.sol988 B
- node_modules/@latticexyz/store/src/IStoreRead.sol3.95 KB
- node_modules/@latticexyz/store/src/IStoreRegistration.sol1.12 KB
- node_modules/@latticexyz/store/src/IStoreWrite.sol2.36 KB
- node_modules/@latticexyz/store/src/Memory.sol2.06 KB
- node_modules/@latticexyz/store/src/ResourceId.sol2.21 KB
- node_modules/@latticexyz/store/src/Schema.sol7.69 KB
- node_modules/@latticexyz/store/src/Slice.sol4.49 KB
- node_modules/@latticexyz/store/src/Storage.sol9.76 KB
- node_modules/@latticexyz/store/src/StoreCore.sol54.25 KB
- node_modules/@latticexyz/store/src/StoreSwitch.sol22.54 KB
- node_modules/@latticexyz/store/src/codegen/index.sol320 B
- node_modules/@latticexyz/store/src/codegen/tables/Hooks.sol15.66 KB
- node_modules/@latticexyz/store/src/codegen/tables/ResourceIds.sol7.18 KB
- node_modules/@latticexyz/store/src/codegen/tables/StoreHooks.sol15.06 KB
- node_modules/@latticexyz/store/src/codegen/tables/Tables.sol26.58 KB
- node_modules/@latticexyz/store/src/constants.sol1.73 KB
- node_modules/@latticexyz/store/src/rightMask.sol838 B
- node_modules/@latticexyz/store/src/storeHookTypes.sol1.78 KB
- node_modules/@latticexyz/store/src/storeResourceTypes.sol515 B
- node_modules/@latticexyz/store/src/tightcoder/DecodeSlice.sol46.44 KB
- node_modules/@latticexyz/store/src/tightcoder/EncodeArray.sol46.1 KB
- node_modules/@latticexyz/store/src/tightcoder/TightCoder.sol3.81 KB
- node_modules/@latticexyz/store/src/version.sol348 B
- node_modules/@latticexyz/world/src/IERC165.sol813 B
- node_modules/@latticexyz/world/src/IWorldContextConsumer.sol1.54 KB
- node_modules/@latticexyz/world/src/System.sol570 B
- node_modules/@latticexyz/world/src/WorldContext.sol9.21 KB
- node_modules/@latticexyz/world/src/revertWithBytes.sol566 B
- node_modules/solady/src/utils/DynamicArrayLib.sol37.21 KB
- node_modules/solady/src/utils/LibBytes.sol38.18 KB
- node_modules/solady/src/utils/LibPRNG.sol22.51 KB
- node_modules/solady/src/utils/LibString.sol44.25 KB
- node_modules/solady/src/utils/SafeTransferLib.sol32.86 KB
- src/codegen/common.sol527 B
- src/namespaces/app/codegen/tables/Account.sol12.37 KB
- src/namespaces/app/codegen/tables/AccountStatus.sol14.02 KB
- src/namespaces/app/codegen/tables/ActiveTaruchi.sol6.3 KB
- src/namespaces/app/codegen/tables/AuthRoles.sol6.89 KB
- src/namespaces/app/codegen/tables/Config.sol6.52 KB
- src/namespaces/app/codegen/tables/Data.sol7.97 KB
- src/namespaces/app/codegen/tables/TaruchiCore.sol11.99 KB
- src/namespaces/app/codegen/tables/TaruchiName.sol6.62 KB
- src/namespaces/app/codegen/tables/TaruchiStatus.sol18.6 KB
- src/namespaces/app/codegen/tables/TaruchiTourney.sol6.34 KB
- src/namespaces/app/codegen/tables/TraitNames.sol6.62 KB
- src/namespaces/app/codegen/tables/TraitsRegistry.sol14.86 KB
- src/namespaces/app/libraries/LibOnyx.sol29.47 KB
- src/namespaces/app/libraries/Taruchi.sol18.48 KB
- src/namespaces/app/libraries/Traits.sol14.6 KB
- src/namespaces/app/libraries/utils/LibAuthRoles.sol1.06 KB
- src/namespaces/app/libraries/utils/LibConfig.sol3.81 KB
- src/namespaces/app/libraries/utils/LibData.sol2.49 KB
- src/namespaces/app/libraries/utils/LibPack.sol7.13 KB
- src/namespaces/app/libraries/utils/LibProgression.sol2.32 KB
- src/namespaces/app/libraries/utils/LibRandom.sol6.96 KB
- src/namespaces/app/libraries/utils/LibSpec.sol7.33 KB
- src/namespaces/app/libraries/utils/LibStats.sol3.34 KB
- src/namespaces/app/libraries/utils/LibXP.sol6.92 KB
node_modules/@latticexyz/store/src/EncodedLengths.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.24;
import { BYTE_TO_BITS } from "./constants.sol";
import { IEncodedLengthsErrors } from "./IEncodedLengthsErrors.sol";
/**
* @title EncodedLengths Type Definition
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)
* @dev Describes how the encoded lengths is structured.
* - 0x00-0x06 The least significant 7 bytes (uint56) represent the total byte length of dynamic (variable length) data.
* - 0x07-0xB The next five bytes (uint40) represent the length of the first dynamic field.
* - 0x0C-0x10 Followed by the length of the second dynamic field
* - 0x11-0x15 Length of the third dynamic field
* - 0x16-0x1A Length of fourth dynamic field
* - 0x1B-0x1F Length of fifth dynamic field
*/
type EncodedLengths is bytes32;
using EncodedLengthsInstance for EncodedLengths global;
// Constants for encoded lengths handling:
// Number of bits for the 7-byte accumulator
uint256 constant ACC_BITS = 7 * BYTE_TO_BITS;
// Number of bits for the 5-byte sections
uint256 constant VAL_BITS = 5 * BYTE_TO_BITS;
// Maximum value of a 5-byte section
uint256 constant MAX_VAL = type(uint40).max;
/**
* @title EncodedLengths Library
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)
* @notice Static functions for handling EncodedLengths type.
* @dev Provides utility functions to pack values into EncodedLengths.
* The caller must ensure that the value arguments are <= MAX_VAL.
*/
library EncodedLengthsLib {
/**
* @notice Packs a single value into EncodedLengths.
* @dev Encodes the given value 'a' into the structure of EncodedLengths. The encoded lengths's accumulator
* will be set to 'a', and the first value slot of the EncodedLengths will also be set to 'a'.
* @param a The length of the first dynamic field's data.
* @return The resulting EncodedLengths containing the encoded value.
*/
function pack(uint256 a) internal pure returns (EncodedLengths) {
uint256 encodedLengths;
unchecked {
encodedLengths = a;
encodedLengths |= (uint256(a) << (ACC_BITS + VAL_BITS * 0));
}
return EncodedLengths.wrap(bytes32(encodedLengths));
}
/**
* @notice Packs two values into EncodedLengths.
* @dev Encodes the given values 'a'-'b' into the structure of EncodedLengths.
* @param a The length of the first dynamic field's data.
* @param b The length of the second dynamic field's data.
* @return The resulting EncodedLengths containing the encoded values.
*/
function pack(uint256 a, uint256 b) internal pure returns (EncodedLengths) {
uint256 encodedLengths;
unchecked {
encodedLengths = a + b;
encodedLengths |= (uint256(a) << (ACC_BITS + VAL_BITS * 0));
encodedLengths |= (uint256(b) << (ACC_BITS + VAL_BITS * 1));
}
return EncodedLengths.wrap(bytes32(encodedLengths));
}
/**
* @notice Packs three values into EncodedLengths.
* @dev Encodes the given values 'a'-'c' into the structure of EncodedLengths.
* @param a The length of the first dynamic field's data.
* @param b The length of the second dynamic field's data.
* @param c The length of the third dynamic field's data.
* @return The resulting EncodedLengths containing the encoded values.
*/
function pack(uint256 a, uint256 b, uint256 c) internal pure returns (EncodedLengths) {
uint256 encodedLengths;
unchecked {
encodedLengths = a + b + c;
encodedLengths |= (uint256(a) << (ACC_BITS + VAL_BITS * 0));
encodedLengths |= (uint256(b) << (ACC_BITS + VAL_BITS * 1));
encodedLengths |= (uint256(c) << (ACC_BITS + VAL_BITS * 2));
}
return EncodedLengths.wrap(bytes32(encodedLengths));
}
/**
* @notice Packs four values into EncodedLengths.
* @dev Encodes the given values 'a'-'d' into the structure of EncodedLengths.
* @param a The length of the first dynamic field's data.
* @param b The length of the second dynamic field's data.
* @param c The length of the third dynamic field's data.
* @param d The length of the fourth dynamic field's data.
* @return The resulting EncodedLengths containing the encoded values.
*/
function pack(uint256 a, uint256 b, uint256 c, uint256 d) internal pure returns (EncodedLengths) {
uint256 encodedLengths;
unchecked {
encodedLengths = a + b + c + d;
encodedLengths |= (uint256(a) << (ACC_BITS + VAL_BITS * 0));
encodedLengths |= (uint256(b) << (ACC_BITS + VAL_BITS * 1));
encodedLengths |= (uint256(c) << (ACC_BITS + VAL_BITS * 2));
encodedLengths |= (uint256(d) << (ACC_BITS + VAL_BITS * 3));
}
return EncodedLengths.wrap(bytes32(encodedLengths));
}
/**
* @notice Packs five values into EncodedLengths.
* @dev Encodes the given values 'a'-'e' into the structure of EncodedLengths.
* @param a The length of the first dynamic field's data.
* @param b The length of the second dynamic field's data.
* @param c The length of the third dynamic field's data.
* @param d The length of the fourth dynamic field's data.
* @param e The length of the fifth dynamic field's data.
* @return The resulting EncodedLengths containing the encoded values.
*/
function pack(uint256 a, uint256 b, uint256 c, uint256 d, uint256 e) internal pure returns (EncodedLengths) {
uint256 encodedLengths;
unchecked {
encodedLengths = a + b + c + d + e;
encodedLengths |= (uint256(a) << (ACC_BITS + VAL_BITS * 0));
encodedLengths |= (uint256(b) << (ACC_BITS + VAL_BITS * 1));
encodedLengths |= (uint256(c) << (ACC_BITS + VAL_BITS * 2));
encodedLengths |= (uint256(d) << (ACC_BITS + VAL_BITS * 3));
encodedLengths |= (uint256(e) << (ACC_BITS + VAL_BITS * 4));
}
return EncodedLengths.wrap(bytes32(encodedLengths));
}
}
/**
* @title EncodedLengths Instance Library
* @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)
* @notice Instance functions for handling EncodedLengths.
* @dev Offers decoding, extracting, and setting functionalities for EncodedLengths.
*/
library EncodedLengthsInstance {
/**
* @notice Decode the accumulated counter from EncodedLengths.
* @dev Extracts the right-most 7 bytes of EncodedLengths.
* @param encodedLengths The encoded lengths to decode.
* @return The accumulated value from the EncodedLengths.
*/
function total(EncodedLengths encodedLengths) internal pure returns (uint256) {
return uint56(uint256(EncodedLengths.unwrap(encodedLengths)));
}
/**
* @notice Decode the dynamic field size at a specific index from EncodedLengths.
* @dev Extracts value right-to-left, with 5 bytes per dynamic field after the right-most 7 bytes.
* @param encodedLengths The encoded lengths to decode.
* @param index The index to retrieve.
* @return The value at the given index from the EncodedLengths.
*/
function atIndex(EncodedLengths encodedLengths, uint8 index) internal pure returns (uint256) {
unchecked {
return uint40(uint256(EncodedLengths.unwrap(encodedLengths) >> (ACC_BITS + VAL_BITS * index)));
}
}
/**
* @notice Set a counter at a specific index in EncodedLengths.
* @dev Updates a value at a specific index and updates the accumulator field.
* @param encodedLengths The encoded lengths to modify.
* @param index The index to set.
* @param newValueAtIndex The new value to set at the given index.
* @return The modified EncodedLengths.
*/
function setAtIndex(
EncodedLengths encodedLengths,
uint8 index,
uint256 newValueAtIndex
) internal pure returns (EncodedLengths) {
if (newValueAtIndex > MAX_VAL) {
revert IEncodedLengthsErrors.EncodedLengths_InvalidLength(newValueAtIndex);
}
uint256 rawEncodedLengths = uint256(EncodedLengths.unwrap(encodedLengths));
// Get current lengths (total and at index)
uint256 accumulator = total(encodedLengths);
uint256 currentValueAtIndex = atIndex(encodedLengths, index);
// Compute the difference and update the total value
unchecked {
if (newValueAtIndex >= currentValueAtIndex) {
accumulator += newValueAtIndex - currentValueAtIndex;
} else {
accumulator -= currentValueAtIndex - newValueAtIndex;
}
}
// Set the new accumulated value and value at index
// (7 bytes total length, 5 bytes per dynamic field)
uint256 offset;
unchecked {
offset = ACC_BITS + VAL_BITS * index;
}
// Bitmask with 1s at the 5 bytes that form the value slot at the given index
uint256 mask = uint256(type(uint40).max) << offset;
// First set the last 7 bytes to 0, then set them to the new length
rawEncodedLengths = (rawEncodedLengths & ~uint256(type(uint56).max)) | accumulator;
// Zero out the value slot at the given index, then set the new value
rawEncodedLengths = (rawEncodedLengths & ~mask) | ((newValueAtIndex << offset) & mask);
return EncodedLengths.wrap(bytes32(rawEncodedLengths));
}
/**
* @notice Unwrap EncodedLengths to its raw bytes32 representation.
* @param encodedLengths The encoded lengths to unwrap.
* @return The raw bytes32 value of the EncodedLengths.
*/
function unwrap(EncodedLengths encodedLengths) internal pure returns (bytes32) {
return EncodedLengths.unwrap(encodedLengths);
}
}
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.