Skip to content

Commit ddc0d79

Browse files
authored
Merge pull request #2 from singnet/fixes/crowdsale
added first day test
2 parents 76c1963 + 017796d commit ddc0d79

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

contracts/foundation/AgiCrowdsale.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ contract AgiCrowdsale is Ownable, ReentrancyGuard {
3232

3333
uint256 public startTime;
3434
uint256 public endTime;
35-
uint256 firstDay;
35+
uint256 public firstDay;
3636

3737
bool public isFinalized = false;
3838
uint256 public weiRaised;

test/TestAgiCrowdsale.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ contract('AgiCrowdsale', async ([miner, firstContributor, secondContributor, whi
4040
assert.equal(cap.toNumber(), web3.toWei(15, 'ether'), "cap is incorrect")
4141
})
4242

43+
it('first day is 24 hours after startTime', async () => {
44+
const firstDay = new Date(await this.agiCrowdsale.firstDay() * 1000)
45+
const startTime = new Date(await this.agiCrowdsale.startTime() * 1000)
46+
const timeDiff = Math.abs(firstDay.getTime() - startTime.getTime())
47+
assert.equal(Math.ceil(timeDiff / (1000 * 3600)), 24, 'should be 24 hours')
48+
})
49+
4350
it('crowdsale contract should be the owner of AGI token', async () => {
4451
assert.equal(await this.token.owner(), this.agiCrowdsale.address, 'Crowdsale is not the owner of the token')
4552
})

0 commit comments

Comments
 (0)