0

I am implementing support of multiple tokens in my application. I want to listen new token received transactions.

I got that I need to decode the input data in any transaction to get the toAddress and Amount of token transferred. But I am confused at a point how can I know if token is really transferred or not? because method in input data can be different for different contracts.

So I know that transfer, transferFrom are methods used to transfer the token. so I can confirm if token-transfer is happened. But I found Transfer and Sweep two methods for a contract. (for eg. Omisego Contract, Omisego Transaction-1, Omisego Transaction). but then I found depositToken method for another contract(for eg. Sharder Contract Sharder Transaction).

So my questions.

  1. How can I get a list of transfer-methods for different tokens?(for eg. transfer-transferFrom for Omisego, depositToken for Sharder etc..)
  2. is Mint method too a type of token transfer method, its here Omisego Contract?
  3. or may be, if transaction is on Etherscan, assume tokens/ETH are always transferred from one address to another address/contract.

Thanks in advance for the help.

1

This is exactly what standards are meant for. Without a standard it's next to impossible to know what functions are supposed to do what and which tokens support which functionality.

The best-known token stardard is ERC20 which defines the function names and some other stuff. If a token does not follow that standard it isn't a valid ERC20 token.

You can't really assume anything with contracts which are not ERC20 compliant. They may do whatever they wish with whatever functions.

Strictly speaking, nobody guarantees that a ERC20 contract transfers tokens with a transfer function either as the implementation is not built-in, so you still have to make other checks to make sure (check token balances before and after).

  • Thanks Lauri for the information. My need was to check while transaction happens, so I managed by listening on Transfer event realtime for respective erc20 tokens. I hope transfer event will be triggered only when transfer is happened for ERC20 token – Maulik Vora Aug 1 '18 at 12:12
  • 1
    In typical implementations yes, it is called only when the transfer has been succesful. But there is no absolute guarantee - it depends on the implementation. – Lauri Peltonen Aug 1 '18 at 19:54
  • Got it Lauri, Thanks. I will assume most of the successful and big ERC20 tokens follows this. no other option ;-) – Maulik Vora Aug 2 '18 at 11:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.