I am going through a tutorial at the moment and have just covered the basics of mappings and structs which I feel like I understand. However, in the next section of the tute we put together mappings and structs and I become a bit lost in the section I bolded ** **. Would someone be able to very slowly take me through the logic so I might be able to better understand what's happening?
uint amount;
uint timestamp;
}
struct Balance {
uint totalBalance;
uint numDeposits;
mapping(uint => Transaction) deposits;
uint numWithdrawals;
mapping(uint => Transaction) withdrawals;
}
mapping(address => Balance) public balanceReceived;
function getBalance(address _addr) public view returns(uint) {
return balanceReceived[_addr].totalBalance;
}
function depositMoney() public payable {
balanceReceived[msg.sender].totalBalance += msg.value;
**Transaction memory deposit = Transaction(msg.value, block.timestamp);
balanceReceived[msg.sender].deposits[balanceReceived[msg.sender].numDeposits] = deposit;**
balanceReceived[msg.sender].numDeposits++;
} ```