Commit 950b6a5e by Jakub Wojciechowski Committed by Francisco Giordano

sanity check for RefundableCrowdsale: goal > 0

parent db40fd31
...@@ -22,6 +22,7 @@ contract RefundableCrowdsale is FinalizableCrowdsale { ...@@ -22,6 +22,7 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
RefundVault public vault; RefundVault public vault;
function RefundableCrowdsale(uint256 _goal) { function RefundableCrowdsale(uint256 _goal) {
require(_goal > 0);
vault = new RefundVault(wallet); vault = new RefundVault(wallet);
goal = _goal; goal = _goal;
} }
......
...@@ -17,6 +17,15 @@ contract('RefundableCrowdsale', function ([_, owner, wallet, investor]) { ...@@ -17,6 +17,15 @@ contract('RefundableCrowdsale', function ([_, owner, wallet, investor]) {
const goal = ether(800) const goal = ether(800)
const lessThanGoal = ether(750) const lessThanGoal = ether(750)
describe('creating a valid crowdsale', function () {
it('should fail with zero goal', async function () {
await RefundableCrowdsale.new(this.startBlock, this.endBlock, rate, wallet, 0, {from: owner}).should.be.rejectedWith(EVMThrow);
})
});
beforeEach(async function () { beforeEach(async function () {
this.startBlock = web3.eth.blockNumber + 10 this.startBlock = web3.eth.blockNumber + 10
this.endBlock = web3.eth.blockNumber + 20 this.endBlock = web3.eth.blockNumber + 20
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment