Complete the code to declare an event named Transfer.
event [1](address indexed from, address indexed to, uint256 value);
The event name Transfer is the standard name used to communicate token transfers in contracts.
Complete the code to emit the Transfer event when tokens move.
emit [1](msg.sender, recipient, amount);The emit keyword triggers the Transfer event to notify listeners of the token movement.
Fix the error in the event declaration to index the 'to' address.
event Transfer(address indexed from, [1] address to, uint256 value);
The indexed keyword allows filtering events by that parameter in logs.
Fill both blanks to complete the event emission with correct parameters.
emit Transfer([1], [2], amount);
The msg.sender is the sender address, and recipient is the receiver address in the event.
Fill all three blanks to create a dictionary comprehension that maps addresses to balances greater than zero.
mapping(address => uint256) public balances;
function getActiveBalances() public view returns (address[] memory) {
address[] memory active;
uint count = 0;
for (uint i = 0; i < [1]; i++) {
address user = users[i];
if (balances[user] [2] 0) {
active[count] = user;
count [3] 1;
}
}
return active;
}We loop through users.length, check if balance is greater than zero, and increment count with +=.