Complete the code to fetch the contract address after deployment.
const contractAddress = deployedContract.[1];The deployed contract object has an address property that stores the contract's address on the blockchain.
Complete the code to listen for the 'Transfer' event emitted by the contract.
contract.on('[1]', (from, to, amount) => { console.log(`Transfer from ${from} to ${to} of ${amount}`); });
The 'Transfer' event is commonly emitted when tokens move between addresses. Listening to it helps monitor contract activity.
Fix the error in the code to correctly fetch the transaction receipt after deployment.
const receipt = await provider.getTransaction[1](txHash);The correct method to get a transaction receipt is getTransactionReceipt. It returns details about the transaction's success and events.
Fill both blanks to create a filter for monitoring events from a specific contract address and event name.
const filter = { address: '[1]', topics: [ethers.utils.id('[2]')] };The filter requires the contract's address and the event signature hashed as a topic. 'Transfer(address,address,uint256)' is the event signature for token transfers.
Fill all three blanks to create a dictionary comprehension that maps event names to their decoded data if the event matches a filter.
const decodedEvents = events.reduce((acc, event) => { if(event.event === '[1]') { acc[event.event] = [2].[3](event.data); } return acc; }, {});This code checks if the event is 'Transfer', then uses the contract interface's decodeEventLog method to decode the event data and store it in a dictionary.