1

Here's the code. The Emit transfer line (In asterisks) is returning the error

// SPDX-License-Identifier: UNLICENSED

pragma solidity ^0.8.0;

contract Transactions { uint256 transactionCount; event Transfer(address from, address receiver, string message, uint256 timestamp, string keyword);

struct TransferStruct {
    address sender;
    address receiver;
    uint amount;
    string message;
    uint256 timestamp;
    string keyword;

}

TransferStruct[] transactions;

function addToBlockchain(address payable receiver, uint amount, string memory message, string memory keyword) public {
    transactionCount += 1;
    transactions.push(TransferStruct(msg.sender, receiver, amount, message, block.timestamp, keyword));

    *emit Transfer(msg.sender, receiver, amount, message, block.timestamp, keyword);
}*
function getAllTransactions() public view returns (TransferStruct[] memory) {
    return transactions;
}
function getTransactionCount() public view returns (uint256) {
    return transactionCount;
}

}

sola24
  • 1,238
  • 3
  • 20
zee
  • 13
  • 4

1 Answers1

4

In your emit you are trying to emit 6 elements .

But in your event function you are only accepting 5 elements

In emit "amount" is an extra argument