mud

MUD is a framework for building ambitious onchain applications

MIT License

Downloads
318.4K
Stars
643
Committers
80

Bot releases are visible (Hide)

mud - @latticexyz/[email protected]

Published by github-actions[bot] about 1 year ago

Patch Changes

mud - [email protected]

Published by github-actions[bot] about 1 year ago

mud - @latticexyz/[email protected]

Published by github-actions[bot] about 1 year ago

Patch Changes

mud - @latticexyz/[email protected]

Published by github-actions[bot] about 1 year ago

Patch Changes

mud - @latticexyz/[email protected]

Published by github-actions[bot] about 1 year ago

Patch Changes

mud - @latticexyz/[email protected]

Published by github-actions[bot] about 1 year ago

Patch Changes

mud - @latticexyz/[email protected]

Published by github-actions[bot] about 1 year ago

mud - @latticexyz/[email protected]

Published by github-actions[bot] about 1 year ago

Major Changes

  • #1399 c4d5eb4e Thanks @alvrs! - - The onSetRecord hook is split into onBeforeSetRecord and onAfterSetRecord and the onDeleteRecord hook is split into onBeforeDeleteRecord and onAfterDeleteRecord.
    The purpose of this change is to allow more fine-grained control over the point in the lifecycle at which hooks are executed.

    The previous hooks were executed before modifying data, so they can be replaced with the respective onBefore hooks.

    - function onSetRecord(
    + function onBeforeSetRecord(
        bytes32 table,
        bytes32[] memory key,
        bytes memory data,
        Schema valueSchema
      ) public;
    
    - function onDeleteRecord(
    + function onBeforeDeleteRecord(
        bytes32 table,
        bytes32[] memory key,
        Schema valueSchema
      ) public;
    
    • It is now possible to specify which methods of a hook contract should be called when registering a hook. The purpose of this change is to save gas by avoiding to call no-op hook methods.

      function registerStoreHook(
        bytes32 tableId,
      - IStoreHook hookAddress
      + IStoreHook hookAddress,
      + uint8 enabledHooksBitmap
      ) public;
      
      function registerSystemHook(
        bytes32 systemId,
      - ISystemHook hookAddress
      + ISystemHook hookAddress,
      + uint8 enabledHooksBitmap
      ) public;
      

      There are StoreHookLib and SystemHookLib with helper functions to encode the bitmap of enabled hooks.

      import { StoreHookLib } from "@latticexyz/store/src/StoreHook.sol";
      
      uint8 storeHookBitmap = StoreBookLib.encodeBitmap({
        onBeforeSetRecord: true,
        onAfterSetRecord: true,
        onBeforeSetField: true,
        onAfterSetField: true,
        onBeforeDeleteRecord: true,
        onAfterDeleteRecord: true
      });
      
      import { SystemHookLib } from "@latticexyz/world/src/SystemHook.sol";
      
      uint8 systemHookBitmap = SystemHookLib.encodeBitmap({
        onBeforeCallSystem: true,
        onAfterCallSystem: true
      });
      
    • The onSetRecord hook call for emitEphemeralRecord has been removed to save gas and to more clearly distinguish ephemeral tables as offchain tables.

Patch Changes

mud - @latticexyz/[email protected]

Published by github-actions[bot] about 1 year ago

mud - @latticexyz/[email protected]

Published by github-actions[bot] about 1 year ago

Patch Changes

mud - @latticexyz/[email protected]

Published by github-actions[bot] about 1 year ago

Patch Changes

mud - @latticexyz/[email protected]

Published by github-actions[bot] about 1 year ago

Major Changes

  • #1399 c4d5eb4e Thanks @alvrs! - - The onSetRecord hook is split into onBeforeSetRecord and onAfterSetRecord and the onDeleteRecord hook is split into onBeforeDeleteRecord and onAfterDeleteRecord.
    The purpose of this change is to allow more fine-grained control over the point in the lifecycle at which hooks are executed.

    The previous hooks were executed before modifying data, so they can be replaced with the respective onBefore hooks.

    - function onSetRecord(
    + function onBeforeSetRecord(
        bytes32 table,
        bytes32[] memory key,
        bytes memory data,
        Schema valueSchema
      ) public;
    
    - function onDeleteRecord(
    + function onBeforeDeleteRecord(
        bytes32 table,
        bytes32[] memory key,
        Schema valueSchema
      ) public;
    
    • It is now possible to specify which methods of a hook contract should be called when registering a hook. The purpose of this change is to save gas by avoiding to call no-op hook methods.

      function registerStoreHook(
        bytes32 tableId,
      - IStoreHook hookAddress
      + IStoreHook hookAddress,
      + uint8 enabledHooksBitmap
      ) public;
      
      function registerSystemHook(
        bytes32 systemId,
      - ISystemHook hookAddress
      + ISystemHook hookAddress,
      + uint8 enabledHooksBitmap
      ) public;
      

      There are StoreHookLib and SystemHookLib with helper functions to encode the bitmap of enabled hooks.

      import { StoreHookLib } from "@latticexyz/store/src/StoreHook.sol";
      
      uint8 storeHookBitmap = StoreBookLib.encodeBitmap({
        onBeforeSetRecord: true,
        onAfterSetRecord: true,
        onBeforeSetField: true,
        onAfterSetField: true,
        onBeforeDeleteRecord: true,
        onAfterDeleteRecord: true
      });
      
      import { SystemHookLib } from "@latticexyz/world/src/SystemHook.sol";
      
      uint8 systemHookBitmap = SystemHookLib.encodeBitmap({
        onBeforeCallSystem: true,
        onAfterCallSystem: true
      });
      
    • The onSetRecord hook call for emitEphemeralRecord has been removed to save gas and to more clearly distinguish ephemeral tables as offchain tables.

Patch Changes

mud - [email protected]

Published by github-actions[bot] about 1 year ago

mud - [email protected]

Published by github-actions[bot] about 1 year ago

mud - @latticexyz/[email protected]

Published by github-actions[bot] about 1 year ago

mud - @latticexyz/[email protected]

Published by github-actions[bot] about 1 year ago

mud - @latticexyz/[email protected]

Published by github-actions[bot] about 1 year ago

Patch Changes

mud - @latticexyz/[email protected]

Published by github-actions[bot] about 1 year ago

Patch Changes

mud - @latticexyz/[email protected]

Published by github-actions[bot] about 1 year ago

Patch Changes

mud - @latticexyz/[email protected]

Published by github-actions[bot] about 1 year ago

Patch Changes