Help wanted with tranche based bonus in a crowdsale

Hi @Roodiger

In your test, the line you were missing is, this goes after you have created your crowdsale:

    await this.token.transfer(this.crowdsale.address, this.totalSupply);

Please ask all the questions that you need. Everyone was new once (see top three recommendations for a new developer in the space).

In your contract, I suggest you use SafeMath so that the following: _currentTier = _currentTier + 50000; becomes: _currentTier = _currentTier.add(50000);

A good place to see how to test and interact with the contracts is the OpenZeppelin tests. e.g. Crowdsale.test.js

There is also a sample crowdsale and test that you can look at for reference.

I recommend (if you haven’t already) reading up on decimals and crowdsale rate, as these can be trickier topics without an explanation.

I also recommend looking at https://github.com/OpenZeppelin/openzeppelin-test-helpers to help in your tests.

1 Like