@tokenfoundry/sale-contracts
Advanced tools
Comparing version 0.2.0 to 0.2.2
{ | ||
"name": "@tokenfoundry/sale-contracts", | ||
"version": "0.2.0", | ||
"version": "0.2.2", | ||
"description": "Code for the new token foundry token and sale base contracts.", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/tokenfoundry/sale-contracts.git", |
@@ -41,2 +41,5 @@ import increaseTime, { duration } from './helpers/increaseTime'; | ||
let vaultInitialAmount; | ||
let vaultDisbursementAmount; | ||
let contributionLimit; | ||
@@ -59,2 +62,5 @@ let contributionLimitBig; | ||
vaultInitialAmount = new web3.BigNumber(1000); | ||
vaultDisbursementAmount = new web3.BigNumber(1000); | ||
contributionLimit = new web3.BigNumber(5000); | ||
@@ -84,2 +90,4 @@ contributionLimitBig = contributionCap.add(1000); | ||
waitingDuration, | ||
vaultInitialAmount, | ||
vaultDisbursementAmount, | ||
startTime, | ||
@@ -141,2 +149,3 @@ { from: owner } | ||
await expectThrow(sale.setEndTime(latest + duration.weeks(1), { from: owner } )); | ||
await expectThrow(sale.emergencyEndSale()); | ||
}); | ||
@@ -305,2 +314,12 @@ | ||
it('should end the sale immediately if emergencyEndSale is called by the sale owner', async () => { | ||
await sale.emergencyEndSale({ from: owner }); | ||
const stageId = await sale.getCurrentStageId.call(); | ||
assert.equal(web3.toUtf8(stageId), 'saleEnded'); | ||
}); | ||
it('should not end the sale someone else tries to emergencyEndSale', async () => { | ||
await expectThrow(sale.emergencyEndSale({ from: nonOwner })); | ||
}); | ||
it ('should not go to SALE_ENDED stage if the cap is not reached or if the end timestamp not passed', async () => { | ||
@@ -414,2 +433,4 @@ let stageId = await sale.getCurrentStageId.call(); | ||
await expectThrow(sale.emergencyEndSale()); | ||
const newSaleEndTime = endTime + duration.weeks(1); | ||
@@ -416,0 +437,0 @@ await expectThrow(sale.setEndTime(newSaleEndTime)); |
@@ -55,4 +55,5 @@ import increaseTime, { duration } from './helpers/increaseTime'; | ||
it('should accept contributions', async () => { | ||
it('should only be possible for the owner to send contributions', async () => { | ||
const value = 10000; | ||
await expectThrow(vault.deposit(contributor, { value, from: notOwner })); | ||
await vault.deposit(contributor, { value, from: owner }); | ||
@@ -74,3 +75,2 @@ | ||
await expectThrow(vault.saleSuccessful({ from: notOwner })); | ||
@@ -102,2 +102,8 @@ | ||
assert.isTrue(post.minus(pre).equals(value)); | ||
const pre_notContributor = web3.eth.getBalance(notContributor); | ||
await vault.refund(notContributor); | ||
const post_notContributor = web3.eth.getBalance(notContributor); | ||
assert.isTrue(post_notContributor.equals(pre_notContributor)); | ||
}); | ||
@@ -158,2 +164,3 @@ | ||
await expectThrow(vault.beginClosingPeriod({ from: notOwner })); | ||
await vault.beginClosingPeriod(); | ||
@@ -160,0 +167,0 @@ const closingDeadline = await vault.closingDeadline.call(); |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
343367
1470
0