0

I was wondering if there is any way for a smart contract to determine where a specific ERC20 transfer came from. That's to say:

Alice and Bob both send a transfer to a smart contract same amount & token and both tx mined on the same block.

Can the smart contract given the SC address of the ERC20 token and the amount determine who sent it, some how?

I know you can determine if the SC owns the fund by doing smth like this:

function sendTokens(address _tokenContract, uint _amountContributed){
      if(uniqueSwap._tokenContract.balanceOf(address(this))!=_amountContributed){revert();}
    }

Im after a bit more trace-ability than this though.

Thanks in advance!

  • You usually use allow() and transferFrom() to accomplish this. – smarx Jan 12 at 21:47
  • If u can give some context and links in an answer ill happilly mark it as correct – Lucas Rodriguez Benitez Jan 12 at 21:58

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.