1
1
const Crowdsale = artifacts . require ( './helpers/AgiCrowdsale.sol' )
2
2
const AGIToken = artifacts . require ( 'SingularityNetToken.sol' )
3
3
const Vault = artifacts . require ( 'RefundVault.sol' )
4
+ const PUBLIC_SUPPLY = new web3 . BigNumber ( 150000000 * Math . pow ( 10 , 8 ) )
4
5
5
6
const { latestTime, duration } = require ( './helpers/latestTime' )
6
7
const { increaseTimeTo } = require ( './helpers/increaseTime' )
@@ -22,7 +23,9 @@ contract('AgiCrowdsale', async ([miner, firstContributor, secondContributor, whi
22
23
this . token = await AGIToken . new ( { from : miner } )
23
24
this . agiCrowdsale = await Crowdsale . new ( this . token . address , wallet , startTime , endTime , rate , cap , firstDayCap , goal , { from : miner } )
24
25
25
- await this . token . setOwnership ( this . agiCrowdsale . address )
26
+ await this . token . transfer ( this . agiCrowdsale . address , PUBLIC_SUPPLY , { from :miner } )
27
+ await this . token . pause ( )
28
+ await this . token . transferOwnership ( this . agiCrowdsale . address )
26
29
await this . agiCrowdsale . updateWhitelist ( [ firstContributor , secondContributor ] , true )
27
30
} )
28
31
@@ -62,8 +65,8 @@ contract('AgiCrowdsale', async ([miner, firstContributor, secondContributor, whi
62
65
} )
63
66
64
67
it ( 'check the balances just after deploy and after crowdsale initialization' , async ( ) => {
65
- assert . equal ( ( await this . token . balanceOf ( miner ) ) . toNumber ( ) , 600000000 * 10 ** 8 , "The miner should hold 600mil" )
66
- assert . equal ( ( await this . token . balanceOf ( this . agiCrowdsale . address ) ) . toNumber ( ) , 400000000 * 10 ** 8 , "The Crowdsale should hold 400mil" )
68
+ assert . equal ( ( await this . token . balanceOf ( miner ) ) . toNumber ( ) , 850000000 * 10 ** 8 , "The miner should hold 600mil" )
69
+ assert . equal ( ( await this . token . balanceOf ( this . agiCrowdsale . address ) ) . toNumber ( ) , 150000000 * 10 ** 8 , "The Crowdsale should hold 400mil" )
67
70
} )
68
71
69
72
} )
@@ -271,6 +274,8 @@ contract('AgiCrowdsale', async ([miner, firstContributor, secondContributor, whi
271
274
await increaseTimeTo ( latestTime ( ) + duration . weeks ( 2 ) )
272
275
273
276
await this . agiCrowdsale . finalize ( )
277
+ await this . agiCrowdsale . transferOwnership ( miner )
278
+
274
279
275
280
assert . isTrue ( await this . agiCrowdsale . isFinalized . call ( ) )
276
281
@@ -291,6 +296,7 @@ contract('AgiCrowdsale', async ([miner, firstContributor, secondContributor, whi
291
296
292
297
await increaseTimeTo ( latestTime ( ) + duration . weeks ( 2 ) )
293
298
await this . agiCrowdsale . finalize ( )
299
+ await this . agiCrowdsale . transferOwnership ( miner )
294
300
295
301
const before = web3 . fromWei ( web3 . eth . getBalance ( firstContributor ) , 'ether' )
296
302
@@ -304,6 +310,8 @@ contract('AgiCrowdsale', async ([miner, firstContributor, secondContributor, whi
304
310
await increaseTimeTo ( latestTime ( ) + duration . weeks ( 2 ) )
305
311
306
312
await this . agiCrowdsale . finalize ( )
313
+ await this . agiCrowdsale . transferOwnership ( miner )
314
+
307
315
308
316
const initialSupply = await this . token . balanceOf ( this . agiCrowdsale . address )
309
317
const balanceBeforeClaim = await this . token . balanceOf ( miner )
@@ -327,6 +335,7 @@ contract('AgiCrowdsale', async ([miner, firstContributor, secondContributor, whi
327
335
await increaseTimeTo ( latestTime ( ) + duration . weeks ( 2 ) )
328
336
329
337
await this . agiCrowdsale . finalize ( )
338
+ await this . agiCrowdsale . transferOwnership ( miner )
330
339
331
340
assert . isFalse ( await this . token . paused . call ( ) , 'token should be unpaused' )
332
341
} )
0 commit comments