Is there a simple ERC20 token and test contract example?

Do you have a comparable post (Simple ERC777 token example) for an ERC20 token?

1 Like

Hi @crypto_economics,

I suggest looking at the following:

Hi @abcoathup thank you for the response. What I really need are test examples written in javascript for a simple ERC20 token.

1 Like

How about this one: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/test/token/ERC20/ERC20.test.js

1 Like

Hi @crypto_economics,

When extending OpenZeppelin Contracts ERC20 implementation to create your own ERC20 token then you should unit test any functionality that you are adding.

You can use the tests in OpenZeppelin Contracts repository for inspiration. (thanks @Skyge :pray:) As a minimum, you would ideally test MetaData, supply, minting (if not fixed supply).

If you haven’t already I would look at the Learn guides on testing:

@Skyge hi, that is the test i tried to run and i got the following error message (attached). I have the openzeppelin/contracts installed and am trying to run the tests included.

1 Like

Hi @crypto_economics,

I have added: Simple ERC20 token example which includes some simple tests based on https://docs.openzeppelin.com/learn/writing-automated-tests#performing-complex-assertions.

1 Like