Replies: 1 comment
-
In Javascript, if you redefine an object property, it is overridden
Hence, in your case the final filter object that is being used only has filter = {
address: contract.address,
topics: [
[ethers.utils.id("Transfer(address,address,uint256)"), ethers.utils.id("Deposit(address,uint256)")]
]
}
provider.on(filter, (log, event) => { console.log(log); }) When an array of hashes is passed instead of hash in topics, then it is taken as OR. reference |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello - if I do something like the below code, will this return logs of each of those events whenever one of them occur, or only when they both occur in the same tx hash? Trying to understand filtering a given contract for multiple events.
filter = { address: contract, topics: [ethers.utils.id("Transfer(address,address,uint256)")], topics: [ethers.utils.id("Deposit(address,uint256)")] } provider.on(filter, (log, event) => { // Emitted whenever a DAI token transfer occurs console.log(log); })
Beta Was this translation helpful? Give feedback.
All reactions