Skip to content

Conversation

@just-mitch
Copy link
Collaborator

@just-mitch just-mitch commented Feb 5, 2026

Summary

  • Add self.emit(Transfer { from, to, amount }) to all balance changes
  • Uses a magic address when the from/to is private

Closes F-296

@just-mitch just-mitch force-pushed the mitch/f-296-token-contract-to-support-public-logs-on-transfer branch from 621d961 to 7886138 Compare February 8, 2026 21:22
@gniumg-source gniumg-source mentioned this pull request Feb 9, 2026
@just-mitch just-mitch force-pushed the mitch/f-296-token-contract-to-support-public-logs-on-transfer branch from 7886138 to ea64007 Compare February 10, 2026 01:29
Comment on lines 46 to 51
const events = await getDecodedPublicEvents<Transfer>(
t.node,
TokenContract.events.Transfer,
receipt.blockNumber!,
1,
);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting, i wasn't aware of getDecodedPublicEvents method, isn't filtering by block number and limit quite fragile? at least on production seems like it would be inconvenient, why not use txHash?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My motivating use case was around being able to scan blocks for these events, so I didn't want to assume I had access to the TxHash.

You're definitely right though that this would be fragile as written in prod, since the contents of the blocks would be subject to reorg until proven, so the polling code would need to be aware of that.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adding feature request related to this: #20332

@just-mitch just-mitch force-pushed the mitch/f-296-token-contract-to-support-public-logs-on-transfer branch from ea64007 to 4264ed4 Compare February 10, 2026 11:26
@just-mitch
Copy link
Collaborator Author

⚠️ Docs Examples Validation Failed

Compile (Noir contracts)

�[38;2;188;109;208m---�[0m �[38;2;95;167;241m�[1mCompiling example contracts�[0m �[38;2;188;109;208m---�[0m
Compiling contracts (bb-hash: 8e49ed0a9246fc48)...
contracts/counter_contract	compile contracts/counter_contract examples
contracts/recursive_verification_contract	compile contracts/recursive_verification_contract examples
contracts/nft	compile contracts/nft examples
contracts/nft_bridge	compile contracts/nft_bridge examples
contracts/bob_token_contract	compile contracts/bob_token_contract examples
contracts/bob_token_contract	Not using cache for contract-disabled-cache.tar.gz due to uncommitted changes/files.
contracts/counter_contract	Not using cache for contract-disabled-cache.tar.gz due to uncommitted changes/files.
contracts/bob_token_contract	Waiting for lock on git dependencies cache...
contracts/nft	Not using cache for contract-disabled-cache.tar.gz due to uncommitted changes/files.
contracts/recursive_verification_contract	Not using cache for contract-disabled-cache.tar.gz due to uncommitted changes/files.
contracts/nft_bridge	Not using cache for contract-disabled-cache.tar.gz due to uncommitted changes/files.
contracts/nft_bridge	error: `dep::aztec` path is deprecated
contracts/nft_bridge	  ┌─ examples/contracts/nft_bridge/src/main.nr:6:9
contracts/nft_bridge	  │
contracts/nft_bridge	6 │     use dep::aztec::{
contracts/nft_bridge	  │         --- Please use `::aztec` instead
contracts/nft_bridge	  │
contracts/nft_bridge	
contracts/nft_bridge	error: `dep::NFTPunk` path is deprecated
contracts/nft_bridge	   ┌─ examples/contracts/nft_bridge/src/main.nr:11:9
contracts/nft_bridge	   │
contracts/nft_bridge	11 │     use dep::NFTPunk::NFTPunk;
contracts/nft_bridge	   │         --- Please use `::NFTPunk` instead
contracts/nft_bridge	   │
contracts/nft_bridge	
contracts/nft_bridge	Aborting due to 2 previous errors
parallel: This job failed:
compile contracts/nft_bridge examples
Seq	Host	Starttime	JobRuntime	Send	Receive	Exitval	Signal	Command
4	:	1770838802.726	     2.771	0	540	1	0	compile contracts/nft_bridge examples

TypeScript validation

(truncated)...
39m: └ Completed
aztecjs_advanced	✓ @aztec/stdlib: 477 .d.ts files
aztecjs_getting_started	�[94m➤�[39m �[90mYN0000�[39m: ┌ Link step
aztecjs_getting_started	�[93m➤�[39m �]8;;https://yarnpkg.com/advanced/error-codes#yn0072---nm_preserve_symlinks_required�YN0072�]8;;�: │ The application uses portals and that's why �[96m--preserve-symlinks�[39m Node option is required for launching it
aztecjs_getting_started	�[94m➤�[39m �[90mYN0000�[39m: └ Completed
aztecjs_getting_started	�[93m➤�[39m YN0000: · Done with warnings in 0s 49ms
aztecjs_getting_started	Verifying linked packages...
aztecjs_getting_started	✓ @aztec/aztec.js: 77 .d.ts files
aztecjs_getting_started	✓ @aztec/accounts: 27 .d.ts files
aztecjs_getting_started	✓ @aztec/test-wallet: 8 .d.ts files
aztecjs_getting_started	✓ @aztec/noir-contracts.js: 33 .d.ts files
aztecjs_connection	Type checking 'aztecjs_connection'...
aztecjs_advanced	Type checking 'aztecjs_advanced'...
aztecjs_authwit	Type checking 'aztecjs_authwit'...
aztecjs_getting_started	Type checking 'aztecjs_getting_started'...
aztecjs_authwit	✓ 'aztecjs_authwit' validated successfully
aztecjs_authwit	Cleaning up temporary files for 'aztecjs_authwit'...
aztecjs_testing	validate_project aztecjs_testing
aztecjs_getting_started	✓ 'aztecjs_getting_started' validated successfully
aztecjs_getting_started	Cleaning up temporary files for 'aztecjs_getting_started'...
bob_token_contract	validate_project bob_token_contract
aztecjs_testing	�[38;2;188;109;208m---�[0m �[38;2;95;167;241m�[1mValidating aztecjs_testing�[0m �[38;2;188;109;208m---�[0m
aztecjs_testing	No custom contracts for 'aztecjs_testing', skipping codegen...
aztecjs_testing	Setting up yarn for 'aztecjs_testing'...
bob_token_contract	ERROR: Artifact not found for 'bob_token_contract': /home/mitch/aztec-clones/bravo/docs/target/bob_token_contract-BobToken.json
parallel: This job failed:
validate_project bob_token_contract
Seq	Host	Starttime	JobRuntime	Send	Receive	Exitval	Signal	Command
2	:	1770838808.601	     5.986	0	1867	0	0	validate_project aztecjs_authwit
4	:	1770838808.610	     6.003	0	1939	0	0	validate_project aztecjs_getting_started
6	:	1770838814.618	     0.032	0	164	1	0	validate_project bob_token_contract
ERROR: Some project(s) failed validation

Action required: Please fix the docs examples or update them to match the current API.

cc @AztecProtocol/devrel

@just-mitch just-mitch force-pushed the mitch/f-296-token-contract-to-support-public-logs-on-transfer branch 2 times, most recently from f7c5510 to 700c04b Compare February 12, 2026 01:08
@just-mitch just-mitch requested a review from a team as a code owner February 12, 2026 01:08
Also accounts for private transfers (burn, mint, transfer_to_private,
transfer_to_public).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@just-mitch just-mitch force-pushed the mitch/f-296-token-contract-to-support-public-logs-on-transfer branch from 700c04b to 1a30c49 Compare February 12, 2026 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants