Revert when using ERC20 transferFrom in a contract

Hi @megatower66,

Welcome to the community :wave:

I didn’t see anywhere where the token holder approved an allowance to the GetNewToken contract, so assume that is the issue. GetNewToken can’t do transferFrom as it doesn’t have an allowance from the token holder.

I suggest looking at: Example on how to use ERC20 token in another contract

As an aside, I noticed that you were creating your own ERC20 token. I would recommend looking at inheriting from the OpenZeppelin ERC20 implementation: https://docs.openzeppelin.com/contracts/3.x/erc20#constructing-an-erc20-token-contract

1 Like