Skip to content
Verified contractExactMIT

DELTuner

Address0x593c151a46610e20118bd612db3acffbe04cb370
Balance

0 ETH

 

Transactions

28

 

Compiler

solc 0.8.30

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.30+commit.73712a01
Language
solidity
Optimization
Yes, 1 runs
EVM version
prague
Via IR
yes
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
25,192,852
Creation transaction
0x8ab8ab0239…5f0909081b

3 files

src/DELTuner.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

import {DELData} from "./DELData.sol";
import {IDELDataStore} from "./DELDataStore.sol";

/// @dev Slim interface the tuner needs from the main DEL contract: token
/// ownership for access control, the per-token behaviour-set index for
/// default lookup, and the active dataStore address (which can be swapped
/// by the owner).
interface IDEL {
    function ownerOf(uint256 tokenId) external view returns (address);
    function behaviourIdxOf(uint256 tokenId) external view returns (uint8);
    function dataStore() external view returns (address);
    function emitMetadataUpdate(uint256 tokenId) external;
    function owner() external view returns (address);
}

/// @title DELTuner
/// @notice Holds per-token parameter overrides for the DEL collection.
/// Each of the 21 animation fields exposes its own owner-only setter.
/// All edits append to an on-chain tuning history. resetTune wipes the
/// overrides (and the "tuned" marker) but preserves the history.
contract DELTuner {
    // ---- canonical field indices (match BEHAVIOUR_FIELDS in encoder) ----
    uint8 public constant F_BASE_RADIUS           = 0;
    uint8 public constant F_ASPECT_RATIO          = 1;
    uint8 public constant F_STEP_SIZE             = 2;
    uint8 public constant F_MOVE_SPEED            = 3;
    uint8 public constant F_MAX_MOVE_DISTANCE     = 4;
    uint8 public constant F_X_BIAS                = 5;
    uint8 public constant F_Y_BIAS                = 6;
    uint8 public constant F_MIN_ROTATION_SPEED    = 7;
    uint8 public constant F_MAX_ROTATION_SPEED    = 8;
    uint8 public constant F_ROTATION_SMOOTHNESS   = 9;
    uint8 public constant F_MAX_ROTATION_ANGLE    = 10;
    uint8 public constant F_BASE_DEFORM_STRENGTH  = 11;
    uint8 public constant F_EXTRA_DEFORM_STRENGTH = 12;
    uint8 public constant F_DEFORM_FREQUENCY      = 13;
    uint8 public constant F_DEFORM_COMPLEXITY     = 14;
    uint8 public constant F_DEFORM_SMOOTHNESS     = 15;
    uint8 public constant F_DRIPPINESS            = 16;
    uint8 public constant F_TIME_SPEED            = 17;
    uint8 public constant F_PERSPECTIVE_DISTANCE  = 18;
    uint8 public constant F_PERSPECTIVE_STRENGTH  = 19;
    uint8 public constant F_BEHAVIOR_CHANGE_TIME  = 20;

    uint8 public constant FIELD_COUNT = 21;
    uint256 public constant MAX_PAGE_SIZE = 500;

    /// @notice Sentinel fieldIdx that marks a TuneRecord as a reset entry
    /// rather than a single-field tune. Lives outside the 0..FIELD_COUNT-1
    /// range so it can never collide with a real field. On a reset record:
    /// `oldValue` carries the bitmap of fields that were wiped, `newValue`
    /// is `0`. The frontend distinguishes reset entries by `fieldIdx == F_RESET`.
    uint8 public constant F_RESET = type(uint8).max;

    // Engine safety bound: deformComplexity is the count of harmonic terms;
    // the JS engine allocates Float32Arrays of this size at every render.
    // Anything < 1 makes the loop a no-op (visual death); anything > 16
    // wastes engine resources and starts to look incoherent. Bounds are
    // expressed in the same int32-scaled-by-SCALE form the rest of the
    // contract uses (so 1.0 == 10000, 16.0 == 160000).
    int32 public constant DEFORM_COMPLEXITY_MIN = 10000;
    int32 public constant DEFORM_COMPLEXITY_MAX = 160000;

    struct TuneRecord {
        uint48  blockNumber;
        address by;
        uint8   fieldIdx;
        int32   oldValue;
        int32   newValue;
    }

    error NotTokenOwner();
    error NotDelOwner();
    error ZeroAddress();
    error OutOfBounds(uint8 fieldIdx);
    error PageOutOfRange();
    error InvalidField(uint8 fieldIdx);

    event Tuned(
        uint256 indexed tokenId,
        address indexed by,
        uint8 fieldIdx,
        int32 oldValue,
        int32 newValue,
        uint256 blockNumber
    );
    event TuneReset(uint256 indexed tokenId, address indexed by, uint256 blockNumber);
    event DelUpdated(address oldDel, address newDel);

    /// @notice The DEL contract this tuner is bound to. Mutable by the
    /// current DEL owner so a small DEL upgrade does not force a tuner
    /// redeploy. Note: swapping `del` does NOT migrate per-token state
    /// already in this tuner — overrides and history stay attached to
    /// the same numeric tokenIds, which may now map to different owners
    /// on the new DEL. Plan accordingly.
    address public del;

    /// @dev Override value per (tokenId, fieldIdx). Only meaningful when the
    /// corresponding bit in `_overrideMask[tokenId]` is set.
    mapping(uint256 => mapping(uint8 => int32)) private _overrides;

    /// @dev 21-bit bitmap of which fields have been overridden for a token.
    /// `_overrideMask[t] == 0` is the "untuned" state.
    mapping(uint256 => uint32) private _overrideMask;

    mapping(uint256 => TuneRecord[]) private _tuneHistory;

    /// @dev The most recent `msg.sender` to call any setter on a given
    /// token. Cleared on resetTune. Surfaced on the SVG as "TUNED BY".
    mapping(uint256 => address) private _lastTunedBy;

    constructor(address _del) {
        if (_del == address(0)) revert ZeroAddress();
        del = _del;
    }

    /// @notice Re-point this tuner at a different DEL contract. Callable
    /// only by the current `del`'s owner. Emits `DelUpdated`.
    function setDel(address newDel) external {
        if (newDel == address(0)) revert ZeroAddress();
        if (msg.sender != IDEL(del).owner()) revert NotDelOwner();
        address old = del;
        del = newDel;
        emit DelUpdated(old, newDel);
    }

    // ------------------------------------------------------------ setters

    function setBaseRadius          (uint256 t, int32 v) external { _set(t, F_BASE_RADIUS, v); }
    function setAspectRatio         (uint256 t, int32 v) external { _set(t, F_ASPECT_RATIO, v); }
    function setStepSize            (uint256 t, int32 v) external { _set(t, F_STEP_SIZE, v); }
    function setMoveSpeed           (uint256 t, int32 v) external { _set(t, F_MOVE_SPEED, v); }
    function setMaxMoveDistance     (uint256 t, int32 v) external { _set(t, F_MAX_MOVE_DISTANCE, v); }
    function setXBias               (uint256 t, int32 v) external { _set(t, F_X_BIAS, v); }
    function setYBias               (uint256 t, int32 v) external { _set(t, F_Y_BIAS, v); }
    function setMinRotationSpeed    (uint256 t, int32 v) external { _set(t, F_MIN_ROTATION_SPEED, v); }
    function setMaxRotationSpeed    (uint256 t, int32 v) external { _set(t, F_MAX_ROTATION_SPEED, v); }
    function setRotationSmoothness  (uint256 t, int32 v) external { _set(t, F_ROTATION_SMOOTHNESS, v); }
    function setMaxRotationAngle    (uint256 t, int32 v) external { _set(t, F_MAX_ROTATION_ANGLE, v); }
    function setBaseDeformStrength  (uint256 t, int32 v) external { _set(t, F_BASE_DEFORM_STRENGTH, v); }
    function setExtraDeformStrength (uint256 t, int32 v) external { _set(t, F_EXTRA_DEFORM_STRENGTH, v); }
    function setDeformFrequency     (uint256 t, int32 v) external { _set(t, F_DEFORM_FREQUENCY, v); }
    function setDeformSmoothness    (uint256 t, int32 v) external { _set(t, F_DEFORM_SMOOTHNESS, v); }
    function setDrippiness          (uint256 t, int32 v) external { _set(t, F_DRIPPINESS, v); }
    function setTimeSpeed           (uint256 t, int32 v) external { _set(t, F_TIME_SPEED, v); }
    function setPerspectiveDistance (uint256 t, int32 v) external { _set(t, F_PERSPECTIVE_DISTANCE, v); }
    function setPerspectiveStrength (uint256 t, int32 v) external { _set(t, F_PERSPECTIVE_STRENGTH, v); }
    function setBehaviorChangeTime  (uint256 t, int32 v) external { _set(t, F_BEHAVIOR_CHANGE_TIME, v); }

    /// @notice The only field with engine-safety bounds. See DEFORM_COMPLEXITY_MIN/MAX.
    function setDeformComplexity(uint256 tokenId, int32 newValue) external {
        if (newValue < DEFORM_COMPLEXITY_MIN || newValue > DEFORM_COMPLEXITY_MAX) {
            revert OutOfBounds(F_DEFORM_COMPLEXITY);
        }
        _set(tokenId, F_DEFORM_COMPLEXITY, newValue);
    }

    /// @notice Wipe every override on `tokenId`. The "tuned" marker clears
    /// and the token reverts to its mint-time configuration. The tuning
    /// history is preserved (every prior tune stays readable), and a new
    /// reset entry is appended to history with `fieldIdx == F_RESET` and
    /// `oldValue` carrying the bitmap of fields that were wiped. Calling
    /// reset on an already-untuned token still emits the event but does
    /// not pollute history.
    function resetTune(uint256 tokenId) external {
        if (IDEL(del).ownerOf(tokenId) != msg.sender) revert NotTokenOwner();
        uint32 mask = _overrideMask[tokenId];
        if (mask == 0) {
            // No-op but still emit so the action is observable.
            emit TuneReset(tokenId, msg.sender, block.number);
            return;
        }
        for (uint8 i = 0; i < FIELD_COUNT; i++) {
            if (mask & (uint32(1) << i) != 0) {
                delete _overrides[tokenId][i];
            }
        }
        delete _overrideMask[tokenId];
        delete _lastTunedBy[tokenId];
        _tuneHistory[tokenId].push(TuneRecord({
            blockNumber: uint48(block.number),
            by:          msg.sender,
            fieldIdx:    F_RESET,
            oldValue:    int32(uint32(mask)),
            newValue:    0
        }));
        emit TuneReset(tokenId, msg.sender, block.number);
        // EIP-4906: refresh marketplace metadata for this token.
        IDEL(del).emitMetadataUpdate(tokenId);
    }

    // ------------------------------------------------------------ views

    function isTuned(uint256 tokenId) external view returns (bool) {
        return _overrideMask[tokenId] != 0;
    }

    /// @notice The address that most recently called a setter on this
    /// token. Returns `address(0)` for untuned tokens (also after a
    /// `resetTune`). The SVG only renders the "TUNED BY" row when this
    /// is non-zero.
    function lastTunedBy(uint256 tokenId) external view returns (address) {
        return _lastTunedBy[tokenId];
    }

    function overrideMaskOf(uint256 tokenId) external view returns (uint32) {
        return _overrideMask[tokenId];
    }

    /// @notice Resolve one field's effective value (override if set, else default).
    /// Reverts if the token has not been minted (delegated to `ownerOf`).
    function effectiveField(uint256 tokenId, uint8 fieldIdx) public view returns (int32) {
        if (fieldIdx >= FIELD_COUNT) revert InvalidField(fieldIdx);
        IDEL(del).ownerOf(tokenId);
        if (_overrideMask[tokenId] & (uint32(1) << fieldIdx) != 0) {
            return _overrides[tokenId][fieldIdx];
        }
        return _defaultFor(tokenId, fieldIdx);
    }

    /// @notice Resolve all 21 effective field values for a token in one call.
    /// Renderers use this to avoid 21 separate STATICCALLs.
    /// Reverts if the token has not been minted (delegated to `ownerOf`).
    function effectiveFields(uint256 tokenId) external view returns (int32[21] memory out) {
        IDEL(del).ownerOf(tokenId);
        uint8 behaviourIdx = IDEL(del).behaviourIdxOf(tokenId);
        bytes memory defaults = IDELDataStore(IDEL(del).dataStore()).behaviourDefaults();
        uint32 mask = _overrideMask[tokenId];
        uint256 base = uint256(behaviourIdx) * FIELD_COUNT * 4;
        for (uint8 i = 0; i < FIELD_COUNT; i++) {
            if (mask & (uint32(1) << i) != 0) {
                out[i] = _overrides[tokenId][i];
            } else {
                out[i] = _readI32(defaults, base + uint256(i) * 4);
            }
        }
    }

    function getTuneCount(uint256 tokenId) external view returns (uint256) {
        return _tuneHistory[tokenId].length;
    }

    function getRecentTunes(uint256 tokenId) external view returns (TuneRecord[] memory) {
        TuneRecord[] storage history = _tuneHistory[tokenId];
        uint256 len = history.length;
        uint256 outLen = len > MAX_PAGE_SIZE ? MAX_PAGE_SIZE : len;
        TuneRecord[] memory out = new TuneRecord[](outLen);
        for (uint256 i = 0; i < outLen; i++) {
            out[i] = history[len - 1 - i];
        }
        return out;
    }

    function getTuneHistoryPage(uint256 tokenId, uint256 start, uint256 count)
        external
        view
        returns (TuneRecord[] memory)
    {
        TuneRecord[] storage history = _tuneHistory[tokenId];
        uint256 len = history.length;
        if (len == 0) return new TuneRecord[](0);
        if (start >= len) revert PageOutOfRange();
        if (count > MAX_PAGE_SIZE) count = MAX_PAGE_SIZE;
        uint256 end = start + count;
        if (end > len) end = len;
        uint256 outLen = end > start ? end - start : 0;
        TuneRecord[] memory out = new TuneRecord[](outLen);
        for (uint256 i = 0; i < outLen; i++) {
            out[i] = history[start + i];
        }
        return out;
    }

    // ------------------------------------------------------------ internals

    function _set(uint256 tokenId, uint8 fieldIdx, int32 newValue) internal {
        if (IDEL(del).ownerOf(tokenId) != msg.sender) revert NotTokenOwner();
        int32 oldValue;
        uint32 mask = _overrideMask[tokenId];
        if (mask & (uint32(1) << fieldIdx) != 0) {
            oldValue = _overrides[tokenId][fieldIdx];
        } else {
            oldValue = _defaultFor(tokenId, fieldIdx);
        }
        _overrides[tokenId][fieldIdx] = newValue;
        _overrideMask[tokenId] = mask | (uint32(1) << fieldIdx);
        _lastTunedBy[tokenId] = msg.sender;
        _tuneHistory[tokenId].push(TuneRecord({
            blockNumber: uint48(block.number),
            by:          msg.sender,
            fieldIdx:    fieldIdx,
            oldValue:    oldValue,
            newValue:    newValue
        }));
        emit Tuned(tokenId, msg.sender, fieldIdx, oldValue, newValue, block.number);
        // EIP-4906: tell marketplaces to refresh this token's metadata.
        // If the tuner is orphaned (DEL.tuner has been swapped), this call
        // reverts — which cleanly bricks orphaned setters by design.
        IDEL(del).emitMetadataUpdate(tokenId);
    }

    function _defaultFor(uint256 tokenId, uint8 fieldIdx) internal view returns (int32) {
        uint8 behaviourIdx = IDEL(del).behaviourIdxOf(tokenId);
        bytes memory defaults = IDELDataStore(IDEL(del).dataStore()).behaviourDefaults();
        uint256 off = uint256(behaviourIdx) * FIELD_COUNT * 4 + uint256(fieldIdx) * 4;
        return _readI32(defaults, off);
    }

    /// @dev Big-endian int32 read from a bytes blob. Matches the encoder's
    /// `encodeI32(value)` output (4 bytes, scale-10000 signed).
    function _readI32(bytes memory data, uint256 offset) internal pure returns (int32) {
        uint32 u = (uint32(uint8(data[offset]))     << 24) |
                   (uint32(uint8(data[offset + 1])) << 16) |
                   (uint32(uint8(data[offset + 2])) << 8)  |
                    uint32(uint8(data[offset + 3]));
        return int32(u);
    }
}

interface IDELTuner {
    function isTuned(uint256 tokenId) external view returns (bool);
    function lastTunedBy(uint256 tokenId) external view returns (address);
    function effectiveField(uint256 tokenId, uint8 fieldIdx) external view returns (int32);
    function effectiveFields(uint256 tokenId) external view returns (int32[21] memory);
}

src/DELData.sol

// SPDX-License-Identifier: MIT
// AUTO-GENERATED by tools/encode-for-solidity.js — DO NOT EDIT BY HAND.
// Regenerate with: node tools/encode-for-solidity.js
pragma solidity ^0.8.24;

/// @notice Immutable config tables for the DEL collection.
/// Numeric values are int32 with scale 10000 (e.g. 5.9 → 59000).
/// Colors are 4-byte RGBA.
/// Strings (char palettes, palette names) are length-prefixed (uint8 length + utf8 bytes).
library DELData {
    // ---- counts ----
    uint256 internal constant CHAR_SET_COUNT  = 28;
    uint256 internal constant PALETTE_COUNT   = 43;
    uint256 internal constant BEHAVIOUR_COUNT = 33;
    uint256 internal constant TOKEN_COUNT     = 256;

    // ---- per-record sizes ----
    uint256 internal constant SCALE = 10000;
    uint256 internal constant FIELD_COUNT          = 21;
    uint256 internal constant MAX_VOIDLING_COLORS  = 12;
    uint256 internal constant NAMED_COLORS_COUNT   = 7;
    uint256 internal constant PALETTE_BYTES        = 76;
    uint256 internal constant BEHAVIOUR_DEFAULTS_BYTES = 84;

    // ---- raw tables ----
    /// @dev BEHAVIOUR_DEFAULTS is a flat table of 33 × 21 int32 values.
    /// Row b, column f starts at byte offset (b * 84 + f * 4) and contains
    /// the field's value scaled by SCALE. Field order matches the
    /// BEHAVIOUR_FIELDS constant in tools/encode-for-solidity.js — never
    /// reorder, only append.
    bytes internal constant BEHAVIOUR_DEFAULTS = hex"00011170000023f00000015e00000104001695400000dac000002d50000011f8000021980000027600007aa8000041a0000020d0000018380000ea60000002f800008e94000003480004da3000008408002bf200000105b800001e7800000172000000fa0015aae00000d2f000002bc000001130000020080000025800007aa800003f4800001f40000016a80000c350000002e4000088b80000030c0004f588000081b0002e14e00000ea6000002bc0000001860000012c0017a6b00000e67800002ee000001324000023280000029400007aa80000445c00002260000019c80000ea600000031600009538000003700004baf0000087f00029f6300000fa00000026480000017c00000190001ab3f000011940000034bc0000177000002af8000002a800007aa8000043300000226000001b580000c350000003200000a028000003fc000493e000008fc00026e8f00000ea6000002cec0000017c000001ae001c3a90000128e0000036b00000190000002cec000002d000007aa800004718000023f000001ce80000ea60000003480000a9ec0000044c00046cd0000093a80024ed200000fde800002bc00000014000000172001dc130000140500000377800001b5800003390000001f400007aa800004f4c00001f4000002260000111700000028a0000a028000003fc00040b280000a410002255100000f2300000251c00000168000001a400205940000157c000003b600000177000002ee0000001a400007aa8000035e800002af800001f400001388000000226000084d0000004c40003a9800000af00001e36600000fde800002bc00000014000000172001dc130000140500000377800001b5800003390000001f400007aa800004f4c00001f4000002260000111700000028a0000a028000003fc00040b280000a410002255100000cb2000002e180000014a000001a4001e848000014820000038a40000145000002cec000001e000007aa8000046500000290400002328000138800000026c00007530000004e20003e4180000a730002143a000010d88000022600000012c000001b8001cafc0000130b0000035e800001a90000032000000020800007aa8000052d0000026480000213400011170000002a80000b7980000041a00041eb00000a0f00023dbb0000088b8000029040000017c000001ae002143a000015f9000003c8c00001f40000039d00000019000007aa800005e8800002af8000027100001388000000208000088b8000004d8000395f80000b1bc001d4c000000ea60000030d40000012200000186001d4c00000138800000377800001b5800003390000001f400007aa8000046500000271000002260000111700000028a0000bb80000004560007a1200000a4d800225510000088b8000029040000017c000001ae002143a000015f9000003c8c00001f40000039d00000019000007aa800005e8800002af8000027100001388000000208000088b8000004d8000395f80000b1bc001d4c00000105b800001e780000013600000168001cfde000013880000036b000001af4000032c8000001fe00007aa8000053fc000027100000219800011170000002940000bb800000042400040b280000a21c002318600000cb2000002cec00000118000001b8001c3a90000130b0000035e800001a90000032c80000022600007aa8000055f0000030d400002260000111700000026c0000bb800000046a0003a9800000afc80020ce700000e67800002af80000015400000190001fbd0000014ff000003a9800001db000003778000001b800007aa800004a38000029040000251c000138800000023a0000b3b00000049c0003bd080000aca8001f47d00000cb2000002cec00000118000001b8001c3a90000130b0000035e800001a90000032c80000022600007aa8000055f0000030d400002260000111700000026c0000bb800000046a0003a9800000afc80020ce700000e290000035e80000012c000001a4001b29200001194000003c8c0000196400002fa80000024400007aa80000514000002bc00000200800011170000002bc0000c3500000040600041eb00000a348002450e00000fde800001d4c000001400000017c001dc130000157c000002ee000001c20000034bc000001f400007aa8000055f0000027d800002260000111700000028a0000bf680000044c0003f7a00000a6040021dfe0000101d0000023f0000001400000017c002191c0000130b0000034bc0000183800002e180000025800007aa800004c2c0000251c00001e780000ea60000002d00000b5a40000047e00045948000097900025d7800000fa00000027d80000014a0000019a00200b20000157c000003b6000001e78000038a4000001a400007aa80000407400001e78000017700000c3500000035200009470000003b600040b280000a410001f47d00000d6d80000251c0000012200000172001cafc0000138800000377800001c20000034bc0000020800007aa8000053fc0000290400002198000111700000028a0000c92c00000438000334500000bd74002143a00000f230000032000000014000000190001a3ec000011170000039d00000183800002bc00000024400007aa800004b00000027d800001db00000ea60000002bc0000c35000000438000445c000009920002673c000011170000027d8000001400000012c001620100000ea6000002fa800001450000023f0000002a800007aa80000458800002328000019640000c3500000030c0000a41000000370000493e000008e94002ab980000101d0000022600000014a0000017c0019a28000011940000030d40000177000002a300000026c00007aa800004c2c000023f000001e780000ea60000002d00000c7380000041a000459480000966400275e200000dac00000290400000154000001b80022551000015f9000003c8c0000200800003a980000019000007aa80000520800002e180000251c00011170000002260000bf68000004e20003bd080000abe0001c3a900000dea800002bc000000140000001ae0020ce70000157c000003b6000001e78000038a4000001a400007aa80000552800002904000024b800011170000002260000c350000004ce0003bd080000add4001dc1300000f618000026480000011800000190001ab3f0000124f8000034bc000019c800002fa80000024400007aa8000050140000264800001f4000011170000002a80000bd740000049c0004323800009c400024ed200000e67800002af80000012c000001a4001b7740000128e0000036b000001b58000032000000020800007aa8000057e400002af80000251c00011170000002580000c350000004a60003e4180000a730002143a00000ea60000029040000010e000001a4001e366000014820000039d000001ce8000035e8000001cc00007aa80000426800001f400000251c00013880000002300000c35000000492000557300000ab18001f47d00000dea800002bc000000140000001ae0020ce70000157c000003b6000001e78000038a4000001a400007aa80000552800002904000024b800011170000002260000c350000004ce0003bd080000add4001dc1300000ea60000027d800000122000001a4002191c000015f9000003c8c00001f40000039d0000001a400007aa800004e200000138800002648000138800000021c0000cb20000004c40003f7a00000a604001cafc00000ea60000029040000010e000001a4001e366000014820000039d000001ce8000035e8000001cc00007aa80000426800001f400000251c00013880000002300000c35000000492000557300000ab18001f47d0";

    bytes internal constant CHAR_SETS         = hex"0b2e2c7e3a3b3d212a2340240b2e2c3b3a213f7c7b7d23400b2e5f2d7e3a3b7c3c3e23240cc2b72c3b3a2b2228297b7d250c2e5fc2b73a3b213f3c3e40260b2e2c27223a7b7d5b5d23240cc2b75f2d3d3a3b7c3c3e40240b2e5f2c3b3a217c3c3e25240cc2b75f2d3a3b213f5b5d402421e2a091e2a083e2a095e2a2b3e2a3aae2a297e2a09fe2a2b7e2a2bee2a1bfe2a3bf21e28692e28690e28693e28691e28696e28697e29e98e28699e29e94e29ebae29ea41dcb99c2b7e2818ee28191e28196e281982ae28182e29cb7e280bbe29cb31ec2a2e282bde282acc2a3c2a5e282b1e282aee282b9e282bfe282b4e282aa1de28098e280b2e280b3e280b4e280b5e280b6e280b7cab9cabacb88cb8a1a2f5c7cc2a6e28096e28184e28895e28ea0e295b1e295b2e295b30cc2b72d213f2b3d3c3e7b7d401de280b85ecb86cb87e288a7e288a8e28c83e28c84e28b80e28b81e28cb50b2e2c273f3b3a3c3e5b5d400cc2b72c3b3a223f2a2b2340240b2e2c3a213f28295b5d7b7d0cc2b72d3b3d213c7b7d5b5d400c2e27c2b73a3b213f2a2b23400cc2b72d3a3b3d2b213f2a25400cc2b73b3a27222d3d2b2a23400b2e272d3a3b213f2a2340240c2ec2b7273a3b213f3d2a23260b2c2d3a3b3d212a2b2340251dcb99c2b7e28898e288972ae2818ee28191e28195e280bbe28182e29cb3";
    bytes internal constant CHAR_SETS_OFFSETS = hex"0000000c001800240031003e004a005700630070009200b400d200f1010f012a013701550161016e017a0187019401a101ae01ba01c701d3";

    bytes internal constant PALETTES             = hex"000000ff111111ff222222ff333333ff222222ff111111ff000000ff111111ff222222ff111111ff000000ff00000000ffffffff000000ff333333ff000000ff111111ff000000ff000000ffffffffffeeeeeeffddddddffccccccffddddddffeeeeeeffffffffffeeeeeeffddddddffeeeeeeffffffffff00000000000000ffffffffffccccccffffffffffeeeeeeffffffffffffffffffddddddffeeeeeeffffffffffffffffffff0000ffff0000ffee0000ffdd0000ffcc0000ffeeeeeeffffffffff00000000060606ffddddddffff0000ffee0000ffddddddffffffffffff0000ff2266ffff3388ffff4477ffff6055ffff7755ffff7f44ffff7755ffff6e66ffff4477ffff3388ffff2c87ffff00000000050a0fff3388ffff7f44ffff7755ffff4477ffff2c87ffff7755ffffaa0000ffcc0000ffdd0000ffee0000ffff0000ffff2200ffff4400ffff7700ffffaa00ffffcc00ffffee00ff00000000080404ffff0000ffffcc00ffff4400ffee0000ffffee00ffffaa00ffee0000ffff2200ffff4400ffff6600ffff8800ffffaa00ffffcc00ffffee00ffff6666ffff4455ffee0033ff00000000090503ffff4400ffffee00ffffaa00ffff6600ffee0033ffff6666ffffff00ffffd700fffcb42effff9d26ffff8c00fffe5c21ffff6243ffff5b3effff5599ffff2277ffff0055ff000000000d0a09ffff5599ffffd700ffff9d26ffff6243ffff0055ffffff00ffff6600ffff9500ffffbb00ffffcc00ffffee00ffe8e809ffb0f307ffa6f900ffdddd00ffffaa00ffff6622ff000000000a0804ffff9500ffffee00ffffcc00ffffaa00ffff6622ffffee00ff00aa93ff00bb92ff00cc6dff00dd22ff00ee11ff01f145ff02f588ff03f192ff22ee6dff99ee00ffccff00ff0000000009100dff09b587ff02f588ff01f145ff09b587ff03b689ff01f145ff5510d0ff6815d8ff7c1ae0ff9520e0ffb020d0ffcc20b0ffe02580fff03050ffff4530ffff6010ffff7500ff000000000a080cffb020d0ffe02580ffcc20b0ff9520e0ffff4530ffe02580ff4400aaff5500bbff7700ccff9900bbffbb2299ffdd4477ffee6655ffffaa22ffffcc00ffeeaa00ffffdd00ff00000000080507ff7700ccffffcc00ffdd4477ffbb2299ffffdd00ffffaa22ff6600aaff8800bbffaa22ccffcc44aaffdd6688ffee8855ffffaa33ffffcc00ffffee00ffaacc66ff77aa99ff00000000040807ffaa22ccffffee00ffffaa33ffcc44aaff77aa99ffffcc00ff6600ffff7711ffff8822ffff9933ffff7744ffff5566ffff3388ffff1199ffff00aaffff04b5e6ff02add4ff000000000e0b12ff9933ffff9933ffff00aaffff9933ffff02add4ff9933ffffff0088ffdd00bbffaa00eeff6622ffff3344ffff0066ffff0099ffff00bbeeff00d6ddff02e2d3ff03e9deff00000000050508ffaa00eeffff0088ff02e2d3ff0066ffff03e9deff00d6ddff5500ddff5f00eeff5922ffff5544ffff3366ffff2288ffffdd2244ffee4422ffff6600ffff8800ffc6eb0fff00000000090b10ff5500ddffdd2244ff2288ffff5544ffffc6eb0fffc6eb0fff00404dff006b77ff008a99ff22bbbbff44ddbbff67e9b9ff83f2c2ffa0f0c8ffb7efb0fffa3956fffb3c4cff00000000060908ff008a99ffb7efb0ff44ddbbff22bbbbfffb3c4cfffa3956ff00aaaaff00ccccff00ddbbff44cc77ff88bb00ffccaa00ffff8800ffe73b88ffbf1ee7ff7837f8ff6844ecff00000000090406ffff8800ffff8800ff00ddbbffe73b88ff6844ecff7837f8ff00a4aaff00c9ccff00ddaaff44ee88ff88ee44ffccdd00ffffaa00ffff6644ffff3344ffef386cffdc2c7eff000000000d0809ff00ddaaffff3344ffffaa00ff44ee88ffdc2c7effff6644ffff3060ffff6040ffffa020ffe0e020ff60e050ff40e0a0ff40c0e0ff5090ffff8060ffffc050f0fff040c0ff00000000080b10ff5090ffff40c0e0ff60e050ffffa020ffd73890ffc050f0ffaa44ffff7766ffff44aaddff22cc88ff44ee66ff88ee44ffccdd00ffeebb00ffff9900ff47dab5ff00aaffff000000000b0511ffaa44ffffff9900ff44ee66ff22cc88ff00aaffffccdd00ff00eeddff00ff99ff66ff44ffaaff00ffeeff00ffffcc00ffff8800ffff4466ffff00aaff6e28faff6e28faff00000000090610ffff4466ff00eeddffffcc00ffff00aaff6e28faffff00aaff00aaaaff00ddffff44aaffff7777ffffaa44ffffdd22ccffff4477ffff8833ffffaa00ff88cc77ff00ddccff00000000090e0effaa44ffffffaa00ffff4477ff00ddccff00ddccffdd22ccffff0088ffdd00ccff8800ffff4400ffff0066ffff00aaddff00ddaaff44ee44ffaaee00ffeeff00ffffdd00ff000000000a0b0eff00aaddffeeff00ff00ddaaffff0088ffffdd00ff44ee44ff0171f1ff007accff00b5bbff00dd44ff44ee00ffccee00ffffcc00ffff9900ffff6600ffff3300ffee0000ff00000000040604ff007accffffcc00ff44ee00ff007accffee0000ffccee00ffec09e8ffd600ddffaa00ddff7013fbff0044ffff0088ffff00ccccff00dd66ff88ee00ffccee00ffffdd00ff0000000009070cffaa00ddff88ee00ff0088ffffd600ddffffdd00ff00dd66ff0000ffff0044ffff006effff0091ffff02d4dcff00e6a4ffcce10affffcc00ffff6600ffff0000ffff0d0dff00000000050709ff0091ffffcce10affffcc00ff006effffff0d0dffff6600ff00ffaaff44ff66ff88ff22ffccff00ffffdd00ffff8800ffff3333ffff0077ffbb00bbff6600ffff009bddff000000000a0906ffff8800ffccff00ffffdd00ffff8800ff009bddffffdd00ff00eeddff00ff99ff55ff55ffaaff00ffeeff00ffffbb00ffff6644ffff00aaffdd00ddffcc00ffffcc00ffff000000000f0a09ffff6644ffffbb00ffdd00ddffff6644ffcc00ffffcc00ffffffbb00ffff9900ffff6600ffee4400ff00aa77ff00cc99ff00eebbff00ffddff1100aaff3300ccff5500eeff00000000080806ffff9900ff00ffddff00cc99ffffbb00ff5500eeffee4400ffee0022ffcc0044ffaa0066ff8800aaff5500ccff2244eeff0066ffff0099ddff00bbaaffff8800ffffaa00ff000000000c0a08ff0066ffffee0022ff0099ddff2244eeffffaa00ff00bbaaff1100aaff2200ccff3300eeff4400ffff5522ffff6644ffff7755ffffc4c401ffddcc00ffffaa00ffff8800ff0000000006050bff4400ffffffaa00ff6644ffff7755ffffff8800ffddcc00ff0d2f95ff064ad3ff0066ffffffee00ffffbb00ffff8800ffff4422ffff1b58fff40b70ffe808a5ffcb09ddff00000000090b10ff064ad3ffff1b58ffffee00ff0066ffffcb09ddffff8800ffffcc00ffffaa00ffff8800ffff6600ffee4422ffdd2233ffbb0044ff00ddccff00bbaaff009988ff007766ff000000000a0805ffff6600ff00ddccffffaa00ff00bbaaffbb0044ff009988ffffee00ffffcc00ffffaa00ffff7744ffff6344ffff44aaffcc22ddff9933ffff6644ffff4466ffff22aaffff000000000a0c0effcc22ddffffee00ffff7744ff9933ffff22aaffffff44aaffff9966ffff7755ffff5566ffff3388ffff00bbffcc00ffff7744ffff3388ffff00bbddff02ceceff03c195ff000000000a0706ffff7755ffff5566ffff3388ffff9966ff03c195ffff3388ffff00aaffee00ccffdd00eeffcc00ffffaa22ffff6870f0ff4888e8ff28a0e0ff20b8d8ff3fc2c2ff3cb6c4ff000000000d0b0fff6870f0ff20b8d8ff28a0e0ffdd00eeff3cb6c4ff4888e8ffddcc44ffffaa55ffff7788ffff5599ffdd55bbffbb55ddff8866eeff6688ffff5566eeff7744ddff8833bbff000000000a0814ffdd55bbff5566eeffdd55bbffff5599ffddcc44ffddcc44ff8800ccffaa44eeff5566ccff00aa66ff00cc44ff66dd00ffaadd00ffddcc00ffffaa00ff6cbea7ff62a5d8ff000000000b060effaa44eeffffaa00ff00cc44ffaa44eeff62a5d8ff66dd00ffff0000ffff4400ffff7700ffffaa00ffffee00ffccdd00ff88cc44ff44aaaaff2288ddff0066ffff0088eeff0000000006070bff2288ddffffaa00ffffaa00ffff4400ff0088eeff0066ffff04afdaff1295e7ff2575f5ff4851f5ff623beeff811fd1ff9427ddffd24efdffff9050ffffbb20ffffdd00ff0000000006090bff1295e7ffff9050ffffbb20ff4851f5ffff9050ffffbb20ff2244aaff3355ccff4466ddff5577eeff6688ffff8888ffffaa77eeffcc66bbffee6688ffff8844ffedbf06ff00000000060810ffaa77eeffee6688ffff8844ffaa77eeffedbf06ffedbf06ffff0066ffff0088ffff00aaffff33ccffff66ddffff99eeffffaaffffff8866ffff6633ffff4400ffff0088ff000000000c070bffff33ccffffaaffffff33ccffff66ddffff0088ffff4400ffffffffffeeeeeeffddddddffccccccffddddddffeeeeeeffffffffffeeeeeeffddddddffeeeeeeffffffffff000000000000aaffffffffffccccccffffffffffeeeeeeffffffffffffffffff";
    bytes internal constant PALETTE_NAMES        = hex"0e626c61636b2d6f6e2d77686974650e77686974652d6f6e2d626c61636b0d737461726b2d6372696d736f6e1366726f7374792d636f6f6c737065637472756d07696e6665726e6f0c7761726d2d636173636164650c73756e7365742d73747269700b736f6c61722d666c6172650c6d61747269782d677265656e11756c74726176696f6c65742d626c617a650c6d79737469632d656d6265720c6475736b2d686f72697a6f6e0a76696f6c65742d6963650b6e656f6e2d6e696768747310756c74726176696f6c65742d6275726e096a6164652d666972650b67686f73742d7368656c6c0f74726f706963616c2d6c61676f6f6e0d7261696e626f772d6275727374096576612d73686966740b616b6972612d626c617a650e67686f73742d70726f746f636f6c0e637962657270756e6b2d6e656f6e0b6a756e676c652d6e656f6e0e6e656f6e2d637962657270756e6b10696e76657273652d737065637472756d0b676f6c64656e2d686f757213616b6972612d626c617a652d6f7267616e69630b6a6164652d67617264656e0b616b6972612d6e696768740e696e6469676f2d636f6d6d616e640d6e656f6e2d737065637472756d0d6372696d736f6e2d73757267650e6e617573696361612d746f7869630a636f72616c2d726565660d6e656f6e2d737065637472756d0b6e656f6e2d6f7263686964086576612d6e6572761266696572792d7761726d737065637472756d10656c6563747269632d73756e7269736509726f73652d6e6f69720b706c61736d612d666972650962736f642d626c7565";
    bytes internal constant PALETTE_NAMES_OFFSETS = hex"0000000f001e002c0040004800550062006e007b008d009a00a700b200be00cf00d900e500f50103010d011901280137014301520163016f0183018f019b01aa01b801c601d501e001ee01fa0203021602270231023d";

    bytes internal constant TUPLES = hex"0a0a191503150b2715121a1f02110207191305060617240f060b0e0b0c0c1b0e1a102413052017110812181c140c0516110a1e17150005230d1a0706051d1b0c030407130304190f110c16011d0e1a2708050503161409061f1e0a000210171a0c220205190b0a1f1206140712061e0f0b1619210f1b15010c2311090820040707001c10132104111b1e1a150e16221f0f1f060620000c2a1916131c020a020a1c1d09031f0a1e0a0d1b1011241103070714181c0c110f102900111016002702060b1b1a20011a0903030403141601182700081d1419080b15190d15261514151704210510270b121b07022513170a110010021b2607131812040e1616241d151b00080b040b010f0a011c031f1502261e0f0817141c1b10231f1a240d18151f01201d151b06022105190e010c1313110f0007290507161b00260a12271d1b06181929090b0800150f1310020014211b010710012801160215001200000c000004200a1115030f020f07020612170028000718021b001506291110041e02110316280a041a04121c1b191d0101150b192201100a021b1a081608160c10121a040e080d1908240b0e020f0e0e08042009121f06011802120814021c11111211100507142200171403030c1010291f1217171b0f06070e03181208180508092002120d0e041d011b2a1e021e14010b0102170913001c0a12070d1a130f0d1f0f041801210f191e090a0d1b0814180017000b09191b1020011b0517280218091617161805070b1911150f1c0d070a0e12221316180b000600102412032606190b170322160311120912090b191a050c0308261b091d10130408090111180e0400031214290207111618191a002020141f01111e200b151c1a06001612110e130a152609040f1e1128200116011a2902070b1d13051d11261802120202170207100709230d19030b022402071a0412051c0c1e0d001f0019150b03250113100a052a160f1212172017001e0c00151a0021081a051c140805021910040b0d010a01151a18071e111315000009090306171825200e1c18182619131e070f1500010908";

    // ---- HTML template chunks ----
    // HEAD = everything before __TOKEN_ID__
    // MID  = between __TOKEN_ID__ and __CONFIG_LITERAL__
    // TAIL = stored in a separate DataChunk contract via SSTORE2 (too large for inline constant)
    bytes internal constant HTML_HEAD = hex"3c21646f63747970652068746d6c3e3c68746d6c3e3c686561643e3c6d65746120636861727365743d227574662d38223e3c6d657461206e616d653d2276696577706f72742220636f6e74656e743d2277696474683d6465766963652d77696474682c696e697469616c2d7363616c653d31223e3c7469746c653e44454c3c2f7469746c653e3c7374796c653e68746d6c2c626f64797b6d617267696e3a303b77696474683a313030253b6865696768743a313030253b6261636b67726f756e643a233030303b6f766572666c6f773a68696464656e7d626f64797b70616464696e673a323070783b626f782d73697a696e673a626f726465722d626f787d406d6564696120286d61782d77696474683a3730307078297b626f64797b70616464696e673a313070787d7d63616e7661737b646973706c61793a626c6f636b3b77696474683a313030253b6865696768743a313030257d3c2f7374796c653e3c2f686561643e3c626f64793e3c63616e7661732069643d2263223e3c2f63616e7661733e3c7363726970743e0a77696e646f772e44454c5f49443d";
    bytes internal constant HTML_MID  = hex"3b0a77696e646f772e44454c5f434f4e4649473d";
}

src/DELDataStore.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

import {DELData} from "./DELData.sol";

/// @notice Holds the immutable config tables as on-chain bytecode constants.
/// Deployed separately so its bytecode doesn't bloat the renderer. Renderers
/// and the tuner call the view functions here to read each table; the calls
/// are cheap STATICCALLs.
contract DELDataStore {
    function behaviourDefaults() external pure returns (bytes memory) { return DELData.BEHAVIOUR_DEFAULTS; }
    function charSets() external pure returns (bytes memory) { return DELData.CHAR_SETS; }
    function charSetsOffsets() external pure returns (bytes memory) { return DELData.CHAR_SETS_OFFSETS; }
    function palettes() external pure returns (bytes memory) { return DELData.PALETTES; }
    function paletteNames() external pure returns (bytes memory) { return DELData.PALETTE_NAMES; }
    function paletteNamesOffsets() external pure returns (bytes memory) { return DELData.PALETTE_NAMES_OFFSETS; }
    function tuples() external pure returns (bytes memory) { return DELData.TUPLES; }
    function htmlHead() external pure returns (bytes memory) { return DELData.HTML_HEAD; }
    function htmlMid() external pure returns (bytes memory) { return DELData.HTML_MID; }
}

interface IDELDataStore {
    function behaviourDefaults() external view returns (bytes memory);
    function charSets() external view returns (bytes memory);
    function charSetsOffsets() external view returns (bytes memory);
    function palettes() external view returns (bytes memory);
    function paletteNames() external view returns (bytes memory);
    function paletteNamesOffsets() external view returns (bytes memory);
    function tuples() external view returns (bytes memory);
    function htmlHead() external view returns (bytes memory);
    function htmlMid() external view returns (bytes memory);
}
Compiler settingsShow
{
  "viaIR": true,
  "metadata": {
    "appendCBOR": true,
    "bytecodeHash": "ipfs",
    "useLiteralContent": false
  },
  "optimizer": {
    "runs": 1,
    "enabled": true
  },
  "evmVersion": "prague",
  "remappings": [
    "solady/=lib/solady/src/",
    "forge-std/=lib/forge-std/src/"
  ]
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.