@@ -41,9 +41,9 @@ window.addEventListener('load', async () => {
41
41
} ) ;
42
42
43
43
// Register a ticker
44
- await polymathAPI . securityTokenRegistry . registerTicker ( {
44
+ await polymathAPI . securityTokenRegistry . registerNewTicker ( {
45
+ owner : myAddress ,
45
46
ticker : ticker ! ,
46
- tokenName : tokenName ! ,
47
47
} ) ;
48
48
49
49
// Get the st launch fee and approve the security token registry to spend
@@ -54,11 +54,13 @@ window.addEventListener('load', async () => {
54
54
} ) ;
55
55
56
56
// Generate a security token
57
- await polymathAPI . securityTokenRegistry . generateSecurityToken ( {
57
+ await polymathAPI . securityTokenRegistry . generateNewSecurityToken ( {
58
58
name : tokenName ! ,
59
59
ticker : ticker ! ,
60
- details : 'http://' ,
61
- divisible : false ,
60
+ tokenDetails : 'http://' ,
61
+ divisible : true ,
62
+ treasuryWallet : myAddress ,
63
+ protocolVersion : '0' ,
62
64
} ) ;
63
65
64
66
// Create a Security Token Instance
@@ -82,16 +84,17 @@ window.addEventListener('load', async () => {
82
84
names . push ( instanceFactory . name ( ) ) ;
83
85
} ) ;
84
86
const resultNames = await Promise . all ( names ) ;
85
-
86
- const finalNames = resultNames . map ( name => {
87
- return bytes32ToString ( name ) ;
88
- } ) ;
89
- const index = finalNames . indexOf ( moduleStringName ) ;
87
+ const index = resultNames . indexOf ( moduleStringName ) ;
90
88
91
89
// Get setup cost
92
90
const factory = await polymathAPI . moduleFactory . getModuleFactory ( modules [ index ] ) ;
93
91
const setupCost = await factory . setupCostInPoly ( ) ;
94
92
93
+ const randomBeneficiaries = [
94
+ '0x3444444444444444444444444444444444444444' ,
95
+ '0x5544444444444444444444444444444444444444' ,
96
+ ] ;
97
+
95
98
// Call to add count transfer manager module with max 3 holders
96
99
await tickerSecurityTokenInstance . addModule ( {
97
100
moduleName,
@@ -100,15 +103,14 @@ window.addEventListener('load', async () => {
100
103
budget : setupCost ,
101
104
archived : false ,
102
105
data : {
103
- maxHolderCount : 3 ,
106
+ maxHolderCount : randomBeneficiaries . length + 1 ,
104
107
} ,
105
108
} ) ;
106
109
107
110
// Get Count TM address and create count transfer manager
108
111
const countTMAddress = ( await tickerSecurityTokenInstance . getModulesByName ( {
109
112
moduleName : ModuleName . CountTransferManager ,
110
113
} ) ) [ 0 ] ;
111
- console . log ( countTMAddress ) ;
112
114
const countTM = await polymathAPI . moduleFactory . getModuleInstance ( {
113
115
name : ModuleName . CountTransferManager ,
114
116
address : countTMAddress ,
@@ -122,18 +124,36 @@ window.addEventListener('load', async () => {
122
124
name : ModuleName . GeneralTransferManager ,
123
125
address : generalTMAddress ,
124
126
} ) ;
125
- // await generalTM.changeAllowAllTransfers({ allowAllTransfers: true });
126
127
127
- const randomBeneficiary1 = '0x3444444444444444444444444444444444444444' ;
128
- const randomBeneficiary2 = '0x5544444444444444444444444444444444444444' ;
129
- const randomBeneficiary3 = '0x6644444444444444444444444444444444444444' ;
128
+ // Add owner address in the whitelist to allow mint tokens
129
+ await generalTM . modifyKYCData ( {
130
+ investor : myAddress ,
131
+ canSendAfter : new Date ( ) ,
132
+ canReceiveAfter : new Date ( ) ,
133
+ expiryTime : new Date ( 2020 , 0 ) ,
134
+ txData : {
135
+ from : await polymathAPI . getAccount ( ) ,
136
+ } ,
137
+ } ) ;
130
138
131
139
// Mint yourself some tokens and make some transfers
132
- await tickerSecurityTokenInstance . issue ( { investor : myAddress , value : new BigNumber ( 200 ) , data : '' } ) ;
133
- await tickerSecurityTokenInstance . transfer ( { to : randomBeneficiary1 , value : new BigNumber ( 10 ) } ) ;
134
- await tickerSecurityTokenInstance . transfer ( { to : randomBeneficiary2 , value : new BigNumber ( 20 ) } ) ;
140
+ await tickerSecurityTokenInstance . issue ( {
141
+ investor : myAddress ,
142
+ value : new BigNumber ( 200 ) ,
143
+ data : '0x00' ,
144
+ } ) ;
145
+
146
+ // Add beneficiaries address to whitelist
147
+ await generalTM . modifyKYCDataMulti ( {
148
+ investors : randomBeneficiaries ,
149
+ canSendAfter : [ new Date ( ) , new Date ( ) ] ,
150
+ canReceiveAfter : [ new Date ( ) , new Date ( ) ] ,
151
+ expiryTime : [ new Date ( 2020 , 0 ) , new Date ( 2020 , 0 ) ] ,
152
+ } ) ;
153
+
154
+ await tickerSecurityTokenInstance . transfer ( { to : randomBeneficiaries [ 0 ] , value : new BigNumber ( 10 ) } ) ;
155
+ await tickerSecurityTokenInstance . transfer ( { to : randomBeneficiaries [ 1 ] , value : new BigNumber ( 20 ) } ) ;
135
156
136
- // We need to increase max holder account to get another transfer through (We are currently at max)
137
157
// Subscribe to event of modify holder count
138
158
await countTM . subscribeAsync ( {
139
159
eventName : CountTransferManagerEvents . ModifyHolderCount ,
@@ -146,13 +166,28 @@ window.addEventListener('load', async () => {
146
166
}
147
167
} ,
148
168
} ) ;
149
- await countTM . changeHolderCount ( { maxHolderCount : 4 } ) ;
150
- await tickerSecurityTokenInstance . transfer ( { to : randomBeneficiary3 , value : new BigNumber ( 30 ) } ) ;
169
+
170
+ // We need to increase max holder account to get another transfer through (We are currently at max)
171
+ randomBeneficiaries . push ( '0x6644444444444444444444444444444444444444' ) ;
172
+ await countTM . changeHolderCount ( { maxHolderCount : randomBeneficiaries . length + 1 } ) ;
173
+
174
+ // And adding to our whitelist
175
+ await generalTM . modifyKYCData ( {
176
+ investor : randomBeneficiaries [ 2 ] ,
177
+ canSendAfter : new Date ( ) ,
178
+ canReceiveAfter : new Date ( ) ,
179
+ expiryTime : new Date ( 2020 , 0 ) ,
180
+ txData : {
181
+ from : await polymathAPI . getAccount ( ) ,
182
+ } ,
183
+ } ) ;
184
+
185
+ await tickerSecurityTokenInstance . transfer ( { to : randomBeneficiaries [ 2 ] , value : new BigNumber ( 30 ) } ) ;
151
186
152
187
// Show the balances of our token holders
153
- console . log ( await tickerSecurityTokenInstance . balanceOf ( { owner : randomBeneficiary1 } ) ) ;
154
- console . log ( await tickerSecurityTokenInstance . balanceOf ( { owner : randomBeneficiary2 } ) ) ;
155
- console . log ( await tickerSecurityTokenInstance . balanceOf ( { owner : randomBeneficiary3 } ) ) ;
188
+ console . log ( await tickerSecurityTokenInstance . balanceOf ( { owner : randomBeneficiaries [ 0 ] } ) ) ;
189
+ console . log ( await tickerSecurityTokenInstance . balanceOf ( { owner : randomBeneficiaries [ 1 ] } ) ) ;
190
+ console . log ( await tickerSecurityTokenInstance . balanceOf ( { owner : randomBeneficiaries [ 2 ] } ) ) ;
156
191
console . log ( await tickerSecurityTokenInstance . balanceOf ( { owner : myAddress } ) ) ;
157
192
158
193
console . log ( 'Funds transferred' ) ;
0 commit comments