Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to emit an event named Transfer.
Blockchain / Solidity
emit [1](msg.sender, recipient, amount); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong event name like Approval instead of Transfer.
Forgetting to emit the event.
✗ Incorrect
The Transfer event is emitted to signal token transfers.
2fill in blank
mediumComplete the code to listen for the Approval event in a test.
Blockchain / Solidity
const filter = contract.filters.[1](owner, spender); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using Transfer event filter when testing Approval.
Misspelling the event name.
✗ Incorrect
The Approval event is used to track allowance changes.
3fill in blank
hardFix the error in the test assertion for event arguments.
Blockchain / Solidity
expect(event.args.[1]).to.equal(recipient); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using sender instead of recipient for the receiver address.
Confusing argument names.
✗ Incorrect
The recipient argument holds the address receiving tokens.
4fill in blank
hardFill both blanks to filter events by sender and minimum amount.
Blockchain / Solidity
const filter = contract.filters.Transfer([1], null, [2]);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping sender and recipient addresses.
Using maxAmount instead of minAmount.
✗ Incorrect
The filter uses senderAddress to specify who sent tokens and minAmount to filter transfers above a value.
5fill in blank
hardFill all three blanks to assert event emission with correct args.
Blockchain / Solidity
await expect(tx).to.emit(contract, '[1]').withArgs([2], [3], amount);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using Approval event instead of Transfer.
Swapping sender and recipient arguments.
✗ Incorrect
The test expects the Transfer event with senderAddress and recipientAddress as first two arguments.