Releases: icdevsorg/ICRC_fungible
Releases · icdevsorg/ICRC_fungible
Update moc and core
ReRelease
[0.2.0] - 2026-02-24
Added
Token Architecture
- Mixin-based token (
token-mixin.mo): Ultra-compact ~150-line token usingincludedirectives for ICRC-1, ICRC-2, ICRC-3, ICRC-4, and TimerTool mixins — all ICRC endpoints auto-generated - Shared Inspect module (
Inspect.mo): Reusable argument validation for cycle drain protection with configurable limits (Configtype), guard functions for inter-canister calls, and compound validators (account, memo, subaccount, Nat, Int, Blob, Text, array length, raw arg size)
Cycle Drain Protection
- Complete
system func inspect()implementation in Token.mo covering all 40+ endpoints - Raw arg size check first (cheapest operation) before expensive Candid decoding
- Per-standard validation: ICRC-1 (
inspectTransfer,inspectBalanceOf), ICRC-2 (inspectApprove,inspectTransferFrom,inspectAllowance,inspectGetAllowances), ICRC-3 (inspectGetBlocks,inspectGetArchives,inspectLegacyBlocks), ICRC-4 (inspectTransferBatch,inspectBalanceOfBatch) - Mint/burn argument validation using
isValidAccount,isValidNat,isValidMemo
New Standard Support
- ICRC-106 (Index Principal):
icrc106_get_index_principal(),set_icrc106_index_principal()with owner authorization - ICRC-107 (Fee Collector Management):
icrc107_set_fee_collector(),icrc107_get_fee_collector()with owner authorization and block type107feecol - ICRC-21 (Consent Messages):
icrc21_canister_call_consent_message()with pluggable consent builders foricrc1_transfer,icrc107_set_fee_collector,icrc2_approve,icrc2_transfer_from,icrc4_transfer_batch - ICRC-10:
icrc10_supported_standards()aliasing ICRC-1 standards list - ICRC-85 (Open Value Sharing): Timer auto-initialization via ClassPlus pattern — no manual
init_icrc85_timercall needed - ICRC-103: Allowance query endpoint
icrc103_get_allowances()with configurableicrc103_max_take_valueandicrc103_public_allowances - ICRC-130: Alias for allowance discovery (via ICRC-2 library)
Index Push Notifications
- Timer-based push notification system: token proactively notifies index canister when new blocks are added with out spamming it
admin_set_index_canister()/get_index_canister()for configuring the index target- Batched notification with 2-second delay to coalesce multiple blocks
- Best-effort messaging with 60-second timeout and error recovery
Rosetta & SNS Compatibility
get_data_certificate()— legacy alias foricrc3_get_tip_certificatematching SNS ledger interfaceis_ledger_ready()— SNS parity readiness checkget_blocks()— Rosetta-compatible block retrieval with archive callbacksget_transactions()— Legacy transaction retrieval formatarchives()— Legacy archive info endpoint withblock_range_start/block_range_endget_tip()— Legacy ICRC-3 tip endpoint- SNS token actor (
snstest.mo) matching SNS ledger argument format for devefi integration
Testing
- 8 new PocketIC test suites for ICRC_fungible:
icrc106.test.ts— Index principal managementicrc107.test.ts— Fee collector get/seticrc107_lifecycle.test.ts— End-to-end fee collector changes with real transfersicrc21.test.ts— Consent message generation for all supported methodsicrc85.test.ts— ICRC-85 cycle sharing functionalityindex_push.test.ts— Push notification system with mock index canisterinspect.test.ts—system func inspect()validation for oversized argumentsverify_token_timer.test.ts— ICRC-85 timer auto-initialization via ClassPlus
- Comprehensive test runner (
runners/run_all_tests.sh, 860 lines):- Runs ICRC-1, ICRC-2, ICRC-3, ICRC-4 library mops + PocketIC tests
- ICRC_fungible mops + PocketIC tests
- DFINITY official ICRC-1/2 test suite against both
tokenandtoken-mixin - Devefi integration tests against both
tokenandtoken-mixin - Rosetta integration tests (including fee collector and archive scenarios)
- Index-NG and index.mo integration tests against both token variants
--skip-*and--only-*flags for selective test execution
- Integration test scripts for Index-NG (
test_index_ng.sh), index.mo (test_index_mo.sh), Rosetta (test_rosetta.sh,test_rosetta_archive.sh,test_rosetta_feecol.sh)
Changed
Core Migration
- Migrated from
mo:basetomo:corethroughout all source files (Token.mo, token-mixin.mo, snstest.mo, Inspect.mo, examples) - Uses
mo:core/Listinstead ofmo:vector/mo:base/List - Uses
mo:core/Mapandmo:core/Setvia library re-exports (ICRC2.CoreMap,ICRC2.CoreSet) persistent actor classsyntax (Motoko 1.1.0+ Enhanced Orthogonal Persistence)transientannotations on init-time-only bindingsRuntime.trapreplacesD.trap
Dependency Updates
icrc1-mo0.2.0 — mixin, inspect, ICRC-106/107/21/10/85, mo:core migrationicrc2-mo0.2.0 — mixin, inspect, ICRC-103/130, cleanup options, mo:core migrationicrc3-mo0.4.0 — mixin, inspect, query archives, LEB128 certificates, mo:core migrationicrc4-mo0.2.0 — mixin, inspect, ICRC-21 consent, mo:core migrationclass-plus0.2.0 — ClassPlus initialization managertimer-tool0.2.0 — TimerTool with mixin supportic-certification1.1.0star0.1.1core2.0.0- Toolchain:
moc = "1.1.0",pocket-ic = "12.0.0"
Code Quality
- Removed redundant
stablekeywords on persistent actor fields - Removed unguarded debug statements from production code
- Fixed unused identifier warnings across Token.mo, snstest.mo, examples
- Fixed ClassPlus system capability (added
<system>type parameter)
Fixed
- ICRC-2
InitArgsupdated with required fields:cleanup_interval,cleanup_on_zero_balance,icrc103_max_take_value,icrc103_public_allowances
Library Changes (upstream)
These changes are in the underlying libraries consumed by this project:
- icrc1-mo 0.2.0: Added mixin, inspect module, ICRC-107/106/21/10/85 support, mo:core migration
- icrc2-mo 0.2.0: Added mixin, inspect module, ICRC-103/130, cleanup timers, fixed double fee collection bug, fixed ICRC-103 access control, fixed index iterator, mo:core migration
- icrc3-mo 0.4.0: Added mixin, inspect module, query archives, fixed certificate LEB128 encoding, mo:core migration
- icrc4-mo 0.2.0: Added mixin, inspect module, ICRC-21 consent, batch size guards, mo:core migration