1
1
const MyToken = artifacts . require ( "./MyToken.sol" ) ;
2
2
const MyTokenCrowdsale = artifacts . require ( "./MyTokenCrowdsale.sol" ) ;
3
3
4
- module . exports = function ( deployer , network , accounts ) {
4
+ const web3 = require ( "web3-utils" ) ;
5
+
6
+ module . exports = ( deployer , network , [ owner ] ) => {
7
+
5
8
const _name = "My Token TRC20" ;
6
9
const _symbol = "MYT" ;
7
10
const _decimals = 18 ;
8
11
const _initialSupply = 16000000 ;
9
12
const _rate = 500 ;
10
- const _wallet = accounts [ 0 ] ;
11
-
12
- let token , crowdsale ;
13
+ const _crowdsaleTokens = web3 . toWei ( "8000000" , "ether" ) ;
14
+
13
15
return deployer
14
- . then ( ( ) => {
15
- return deployer . deploy ( MyToken , _name , _symbol , _decimals , _initialSupply ) ;
16
- } )
17
- . then ( ( instance ) => {
18
- token = instance ;
19
- return deployer . deploy ( MyTokenCrowdsale , _rate , _wallet , MyToken . address , _wallet ) ;
20
- } )
21
- . then ( ( instance ) => {
22
- crowdsale = instance ;
23
- token . transferOwnership ( crowdsale . address ) ;
24
- token . approve ( crowdsale . address , _initialSupply * 10 ** 18 ) ;
25
- } ) ;
26
-
16
+ . then ( ( ) => deployer . deploy ( MyToken , _name , _symbol , _decimals , _initialSupply ) )
17
+ . then ( ( ) => deployer . deploy ( MyTokenCrowdsale , _rate , owner , MyToken . address , owner ) )
18
+ . then ( ( ) => MyToken . deployed ( ) )
19
+ . then ( token => token . approve ( MyTokenCrowdsale . address , _crowdsaleTokens ) ) ;
27
20
} ;
0 commit comments