total knows the sum and nothing else. Two people deposit and it cannot tell you who holds what.
Add this beside it:
mapping(address => uint256) public balances;
Read it as a lookup: hand it an address, get a number back.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
contract Ledger {
uint256 public total;
function deposit(uint256 amount) external {
total += amount;
}
function balanceOf(address who) external view returns (uint256) {
return 0;
}
}