ERC20 Token Sales with Whitelisting Feature

Lim Chee Kin
2 min readSep 24, 2021

I think the Initial Coin Offering (ICO) is the first use case every Solidity developer need to get familiar with even the ICO mania is behind us.

The token known as Fluwix with symbol FWX, as I assumed whatever I learned here will be integrated into another project of the same name in the future. The exchange rate of ETH to FWX is 1 to 1. For example, for 0.001 ETH you will get 0.001 FWX in return.

The project is created by referred to an excellent tutorial published by Thomas Wiesner. The key feature of the project is whitelisting. Only the address of user accounts being whitelisted by the owner (the deployer of the contract) can buy the token.

The project is using the following third party libraries to simplify codes:

  • Use @openzeppelin/contracts@4.3.1 for implementation of ERC20
  • Reuse the code of Crowdsale.sol from @openzeppelin/contracts@2.3.0.
  • Use @openzeppelin/test-helpers@0.5.13 for writing unit tests.

It is tested with MetaMask Chrome extension and Android. I think it is good idea to test out the dApps yourself before looking into the code.

The dApps is interacting with smart contracts running on Rinkeby testnet, hence you need some ETH in your wallet. If you don’t have any, you can request some ETH from Rinkeby Faucet.

If you are interested to look into the code and run it in your local machine, please check out the git repository hosted at https://github.com/limcheekin/eth-erc20-token-sale. Feel free to fork the repository and send me pull request.

I hope to hear from you soon! :)

--

--

Lim Chee Kin

A business-minded full stack developer. Experienced in Java technology, interested on DApps, Solidity, Flutter, online marketing and algorithmic trading.