ERC20 contract receive and send other ERC20 tokens

Hello i am trying to find away how can one ERC20 contract can receive and send other ERC20 tokens to wallets and contracts.

Example Token ABC (my ERC20) contract receive 100 GRT tokens.
Token ABC now have 100GRT available in the contract wallet.

Token ABC want to send 10GRT tokens to regular user wallet address - How that can be implemented ?

Hey @jay_vi, hope you are well.

The Ethereum Smart Contract Programming 201 course will teach you how to create a DEX, on this DEX you will learn how to manage multiple tokens like you mention in your post.

In your example, Token ABC contract receive 100 GRT tokens. meaning the contract address will receive the GRT token on that contract balance, that then can be used later for any other case.

Token ABC will not store the GRT token in its internal contract, the GRT balance for the ABC contract is stored on the GRT contract (balanceOf(ABC contract address))

Carlos Z

hey mate thanks for this tip will check it. appreciate the help:)

1 Like

just the thing i am worried the GRT contract in real case is not mine some other token in the dex part is it explained how to proceed with tokens that i dont have ownership?

1 Like

All ERC20 tokens fulfill the standard functions, although you are not the owner, the 201 course give a beautiful example to manage multiple tokens (erc20) through the erc20 interface properly.

There is no issue by not having the ownership of a token, you still can interact with him through the erc20 interface :nerd_face:

Carlos Z

Very informative post. I really do hope and pray this stuff works!

1 Like

actually i managed to do it its pretty easy once you understand it :joy:

1 Like