Complete the code to listen for the 'Transfer' event on a contract.
contract.on('[1]', (from, to, amount) => { console.log(`Transfer from ${from} to ${to} of ${amount}`); });
The event name to listen for is 'Transfer'. This matches the event emitted by the contract.
Complete the code to remove the event listener for 'Transfer'.
contract.[1]('Transfer', callbackFunction);
To remove a specific event listener, use removeListener with the event name and callback.
Fix the error in the code to correctly listen for events with filters.
const filter = contract.filters.[1](null, userAddress); contract.on(filter, (from, to, amount) => { console.log(`Filtered transfer from ${from} to ${to} of ${amount}`); });
The filter should be created for the 'Transfer' event to listen for transfers involving the user address.
Fill both blanks to create a filter for 'Approval' events where the owner is a specific address.
const filter = contract.filters.[1]([2], null);
The filter is for 'Approval' events where the first parameter (owner) matches the given address.
Fill all three blanks to listen for 'Deposit' events and log the depositor and amount.
contract.on('[1]', ([2], [3]) => { console.log(`Deposit by ${depositor} of ${amount}`); });
The event name is 'Deposit'. The callback parameters are 'depositor' and 'amount' to match the event signature.