Skip to content

Commit

Permalink
Remove early finalization
Browse files Browse the repository at this point in the history
  • Loading branch information
federicobond committed Jul 20, 2017
1 parent b4ee238 commit 9f07555
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
13 changes: 0 additions & 13 deletions contracts/MANACrowdsale.sol
Expand Up @@ -108,19 +108,6 @@ contract MANACrowdsale is ContinuousCrowdsale, CappedCrowdsale, WhitelistedCrowd
continuousSale = true;
}

function hasEnded() constant returns(bool) {
return isFinalized || super.hasEnded();
}

function finalize() onlyOwner {
require(!isFinalized);

finalization();
Finalized();

isFinalized = true;
}

function finalization() internal {
uint256 totalSupply = token.totalSupply();
uint256 finalSupply = TOTAL_SHARE.mul(totalSupply).div(CROWDSALE_SHARE);
Expand Down
13 changes: 8 additions & 5 deletions test/MANACrowdsale.js
Expand Up @@ -42,7 +42,10 @@ contract('MANACrowdsale', function ([_, wallet, wallet2, investor, purchaser, in

it('owner should be able to start continuous sale', async function () {
await crowdsale.startContinuousSale().should.be.rejectedWith(EVMThrow)

await advanceToBlock(endBlock)
await crowdsale.finalize()

await crowdsale.startContinuousSale().should.be.fulfilled
const enabled = await crowdsale.continuousSale()
enabled.should.equal(true)
Expand Down Expand Up @@ -104,24 +107,24 @@ contract('MANACrowdsale', function ([_, wallet, wallet2, investor, purchaser, in

// since price at first block is 1000, total tokens emitted will be 4000
await crowdsale.buyTokens(investor, {value: 4, from: purchaser})

await advanceToBlock(endBlock)
await crowdsale.finalize()

const balance = await token.balanceOf(wallet)
balance.should.be.bignumber.equal(expectedFoundationTokens)

const totalSupply = await token.totalSupply()
totalSupply.should.be.bignumber.equal(expectedTokenSupply)
})

it('auction can be finalized early by owner', async function () {
await advanceToBlock(startBlock + 5)
await crowdsale.finalize().should.be.fulfilled
})

it('should initialize a continuous issuance rate during finalization', async function () {
await advanceToBlock(startBlock - 1)

// since price at first block is 1000, total tokens emitted will be 4000
await crowdsale.buyTokens(investor, {value: 400, from: purchaser})

await advanceToBlock(endBlock)
await crowdsale.finalize()

// total tokens emitted will be 1000000 (400000 to investor and 600000 to
Expand Down

0 comments on commit 9f07555

Please sign in to comment.