I want to create a smart contract which will allow multiple users to deposit / withdraw funds. My first approach was to simply have one contract address which will store the funds of all users and a mapping which will track individual balances of each of the users, however this would prevent me from being able to identify deposits for particular users, as they would all be depositing to the same address.
In order to overcome this, I want the smart contract to generate a child contract for each user to which that user can deposit funds to. The problem is that deploying this child contract will cost gas. I don't want the user to pay this gas cost, however if I have the parent contract refund the users gas costs, a potential attack arises when someone can create multiple accounts in order to have the contract spend it's whole balance on this task. How can I overcome this?