Error using ERC20 transferFrom in a buy function selling tokens

Correct. transferFrom is used with approve where first a token holder approves an allowance and then calls a smart contract that can use that allowance with transferFrom.

You can still use OpenZeppelin Contracts 2.x to create a crowdsale, though I recommend looking at Points to consider when creating a fungible token (ERC20, ERC777)

You could potentially add your token to a decentralized exchange and provide liquidity. Though a working solution requiring your token should come first.

Distributing tokens to users of your solution is also a way to go.

I think non-fungible tokens (such ERC721) are fun to experiment with. I also like experiments with personal tokens.

1 Like