I'm trying to implement a mechanism to generate random addresses for users to deposit ERC20 tokens and then consolidate the deposited tokens to a cold wallet address later, somewhat like what an exchange does when users deposit tokens to exchange addresses. Right now it seems I have two options:
Generate a new address for each user (with random private keys or with an HD wallet scheme). After a user deposit tokens to the generated address, we need to first send some ether as gas to the address, then call the token method to transfer the token back to our cold wallet.
Generate a new contract address for each user with a master address. After a user deposit tokens to the generated address, we call the contract with the master owner address to withdraw the token to our cold wallet.
Both methods seem to have their own caveats, as for generating a new normal address for each user, when consolidating we need to first calculate the ether required as gas, and send ether to that address, and then call the token contract to transfer the tokens, which is quite convoluted and need two transactions meaning spending gas twice.
For generating a new contract address for each user, it means for each new user we need to spend gas to create the new contract, which could be a waste if there are many users that don't deposit tokens.
I'm wondering if anyone has any idea what's the standard procedure used by those top exchanges nowadays, how do they handle the gas fees when consolidating ERC20 tokens to cold wallet and withdrawing the ERC20 tokens?