sanity check for CappedCrowdsale: cap > 0

This commit is contained in:
Jakub Wojciechowski
2017-07-14 16:06:09 +01:00
committed by Francisco Giordano
parent 6035bd522b
commit db40fd314a
2 changed files with 10 additions and 0 deletions

View File

@ -13,6 +13,7 @@ contract CappedCrowdsale is Crowdsale {
uint256 public cap;
function CappedCrowdsale(uint256 _cap) {
require(_cap > 0);
cap = _cap;
}

View File

@ -19,6 +19,15 @@ contract('CappedCrowdsale', function ([_, wallet]) {
const cap = ether(300)
const lessThanCap = ether(60)
describe('creating a valid crowdsale', function () {
it('should fail with zero cap', async function () {
await CappedCrowdsale.new(this.startBlock, this.endBlock, rate, wallet, 0).should.be.rejectedWith(EVMThrow);
})
});
beforeEach(async function () {
this.startBlock = web3.eth.blockNumber + 10
this.endBlock = web3.eth.blockNumber + 20