Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

evm: emit Transfer events on L1 deposits #3410

Merged
merged 2 commits into from
May 28, 2024

Conversation

dessaya
Copy link
Collaborator

@dessaya dessaya commented May 23, 2024

No description provided.

metadata, err := isc.IRC27NFTMetadataFromBytes(nft.Metadata)
if err != nil {
panic(errEVMCanNotDecodeERC27Metadata)
}

addr := iscmagic.ERC721NFTCollectionAddress(nft.ID)
state := emulator.NewStateDBFromKVStore(emulator.StateDBSubrealm(store))
state := emulator.NewStateDBFromKVStore(evm.EmulatorStateSubrealm(evmState))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@lmoe @jorgemmsilva

I think this was a bug because it was calling emulator.StateDBSubrealm() twice (once here and again inside NewStateDBFromKVStore.

I'm not sure about the implications of the bug, I think the erc721 contract was being stored under some bogus key. I also don't know how this affects the production instances.

erc721CollectionContractAddress := iscmagic.ERC721NFTCollectionAddress(collectionID)
stateDB := emulator.NewStateDB(newEmulatorContext(ctx))
if stateDB.Exist(erc721CollectionContractAddress) {
logs = append(logs, makeTransferEvent(erc721CollectionContractAddress, addr, iscmagic.WrapNFTID(nftID).TokenID()))
Copy link
Contributor

Choose a reason for hiding this comment

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

won't this produce 2 events if the NFT belongs to a collection? I think it should only produce 1 event (from the collection contract)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, it produces 2 events. I'm not sure what is the expected behavior; I guessed it was like this but I can change it if it's wrong.

Copy link
Contributor

Choose a reason for hiding this comment

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

only 1 event should be produced IMO

@dessaya dessaya force-pushed the emit-transfer-events branch from c4926ad to a606d80 Compare May 28, 2024 14:34
@jorgemmsilva jorgemmsilva merged commit b62c52f into iotaledger:develop May 28, 2024
5 checks passed
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