How to collect ERC20 tokens?

1. Problem scenario

Assuming that your platform needs to support 50 ERC20 tokens, users will recharge the Ethereum addresses generated by your platform, and then you have to collect the tokens on these platform addresses into your cold wallet.

Question : There is no Ether on the platform recharge address you generated for users, so there is no way to directly use this address to call the ERC20 token trasfer()method for collection. I know that gas fees cannot be saved, so can I use other accounts to pay for these transfer transactions of ERC20 tokens on these recharge addresses?

2. Solution

To grasp the block chain and digital currency application development, network recommended Ebizal block chain to develop an online tutorial series . The content covers multiple mainstream blockchain platforms such as Bitcoin, Ethereum, EOS, Hyperledger, Tendermint, and supports multiple development languages ​​such as Java, C#, Python, PHP, JavaScript, and Dart.

Simply put, in any case, your token recharge address needs a certain amount of Ether to pay for gas. The existing ERC20 standard also does not support paying gas fees with other accounts. Although there have been some proposals to try to solve this problem from different angles, none of them have formed a standard. E.g:

  • EIP 865: Support proxy transfer/delegatedTransfer, see EIP 865 for details
  • EIP 965: ERC777 has been expanded, and a Cheque Operator has been added, see EIP 965 for details

These proposals all require modification of the token contract, so it is of no use to the existing ERC20 tokens.

Therefore, the obvious solution is to send a sufficient amount of Ether to the generated address to cover the gas cost required to collect tokens.

3. How does the exchange do?

Most exchanges (if not all) adopt the following scheme:

  • Generate recharge address
  • Transfer a certain amount of Ether to the address to cover the gas cost of several token transfers
  • When the user is inactive for more than a period of time, the ether on the address is recovered
  • All ERC20 tokens of each user use the same deposit address

Original link: How to collect ERC20 tokens that do not have an Ethereum address? -Huizhi Network

Guess you like

Origin blog.csdn.net/shebao3333/article/details/102999756