I'm learning how to build a smart contract that is able to receive ETH and, if certain conditions are met, send ETH back to the address from which it received it.
My understanding currently is that a smart contract has a wallet address. That means that somebody could hypothetically just type in a smart contract address in Coinbase and send funds that way.
If that is the case, how can the smart contract be programmed to detect which wallet sent it the ETH and execute some action for each such situation? If that isn't the case, please explain to me where I'm wrong.
If that is the case but it is impossible to implement functionality like what I described in the previous paragraph, are there any other solutions you would suggest?
Links to wider tutorials, articles, etc. are much appreciated.