Are there differences in depositing, storing and sending tokens between ERC20, 721 and 1155?

I understood that tokens are not stored in wallets, but instead, wallets are "watching" the blockchain for transactions related to their underlying addresses.

I also understood that ERC20, 721 and 1155 have a different underlying smart contract code with specific methods.

If I had to create a wallet and manage the deposit, the custody and the transfer of these 3 types of tokens, can this be done in a generic way, or do I have to implement a specific implementation per type of token?

Thank you for your help!

Hey hystrixcarton,

Welcome to the community!

I'd say you'd need 3 types of implementations to transfer in this case since the underline code could be different. So, one for ERC-721, one for ERC-20, and one for ERC-1155.

The functions you should be looking for would be

  1. Approve : approve or setApprovalForAll
  2. Transfer : transfer, transferFrom or safeTransferFrom
    depending on the context.

The approval method will approve the particular token to be transferred on behalf if required.

Here are the OpenZeppelin implementations of ERC-20, ERC-721 and ERC-1155 following their respective EIP-20, EIP-721 and EIP-1155

1 Like