feat(src20): emit Transfer event to both sender and recipient#130
Merged
ameya-deshmukh merged 3 commits intomainfrom Mar 25, 2026
Merged
feat(src20): emit Transfer event to both sender and recipient#130ameya-deshmukh merged 3 commits intomainfrom
ameya-deshmukh merged 3 commits intomainfrom
Conversation
Previously, emitTransferEncrypted only emitted the encrypted Transfer event to the recipient. This makes it symmetric by also emitting to the sender, independently of whether the other party has a registered AES key. Adds 12 tests covering all combinations of key registration for transfer, transferFrom, mint, and burn.
…enerated AES keys Use deployCodeTo to deploy real Directory and Intelligence contracts at their genesis addresses. Generate AES keys via the RNG precompile (CryptoUtils.generateRandomAESKey) and register them with Directory. Validate events using vm.recordLogs instead of mock expectations.
For every test where a party has a registered AES key, decrypt the emitted encrypted amount using Directory.decrypt() and assert it matches the original transfer amount. This verifies the full encrypt→emit→decrypt round-trip through real AES-256-GCM precompiles.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
emitTransferEncryptednow emits theTransferevent to both the sender and recipient, independently. Previously only the recipient received it.SRC20Events.t.solcovering all combinations: both have keys, only sender, only recipient, neither — fortransfer,transferFrom,mint, andburn.Test plan
sforge test --match-contract SRC20EventsTest