psuedocode:
contract someContract {
address author = "0x00...";
mapping (address => uint) public sentToAuthor;
function sendToAuthor () public payable {
sentToAuthor[msg.sender] = msg.value;
author.call{value: msg.value}("");
}
}
Your question doesn't really make sense.
What I don't understand is how to check if the msg.sender gave the smart contract the money or not.
You just look at the value of msg.value. If the transaction doesn't revert, and the function is payable, and you don't send it anywhere else, then your contract receives those funds. Period. No "checking" needed. If you do want to check, you could on the client side, but just looking at the contract balance (e.g., ethers.utils.balanceOf(contractAddress), or something). You could also just look at the mapping here, it will be correct and show you.
If I can check that, I can take the msg.value from the mapping and send it to the author, but how do I check that the sender actually made the eth transfer to the contract?
The "msg.value" won't actually be "in" the mapping, mappings can't actually hold eth, they can only hold a uint. It just tells you how much was sent to the contract.
Btw, as written here, it sends it straight to the author, so it won't stay in the contract. If you remove the last line of "sendToAuthor" (the author.call line), then the eth will just stay in the contract itself, instead.
(btw, there's an ethereum stackoverflow, you should be asking there.)