Skip to content

Releases: icdevsorg/icrc4.mo

ReRelease

24 Feb 22:15

Choose a tag to compare

[0.2.0] - 2026-02-24

Added

  • Mixin pattern (mo:icrc4-mo/ICRC4/mixin) for automatic endpoint generation using persistent actor class and Class+
  • Inspect module (mo:icrc4-mo/ICRC4/Inspect) for cycle drain protection — critical for batch operations:
    • inspect* functions (return Bool) for use in system func inspect()
    • guard* functions (trap on invalid) for inter-canister protection
    • Built-in guards in mixin for icrc4_transfer_batch and icrc4_balance_of_batch
    • Validates batch size, individual transfer args, and each account in balance queries
    • configWithLedgerLimits(maxTransfers, maxBalances) for tighter validation from ledger config
    • Configurable limits via Config type and configWith() helper
  • Interface module (mo:icrc4-mo/ICRC4/Interface) with extensible before/after hooks for all ICRC-4 endpoints
  • ICRC-21 consent message support: consent builder for icrc4_transfer_batch
  • defaultMixinArgs() helper for ergonomic mixin configuration with with syntax
  • Complete README with mixin usage examples, inspect documentation, API reference tables, and migration guide

Changed

  • Migrated to mo:core (replacing mo:base, mo:map, mo:vector)
  • Migrated to Motoko 1.1.0 with Enhanced Orthogonal Persistence
  • Added v000_002_000 migration for state types
  • Uses Map.empty/Map.add with compare functions instead of hash-based operations
  • Uses List from core instead of Vec
  • Uses Runtime.trap/Debug.print instead of D.trap/D.print
  • Updated mops.toml to require moc = "1.1.0" toolchain

Technical Details

  • Uses persistent actor class syntax (Motoko 1.1.0+)
  • ClassPlus async initialization with ClassPlusInitializationManager
  • Star monad error handling for batch transfer operations
  • Non-atomic batch semantics: each transfer succeeds or fails independently
  • Batch size guards are the most critical defense against cycle drain attacks