@@ -24,6 +24,7 @@ import {
24
24
GetLogs ,
25
25
Perm ,
26
26
PERCENTAGE_DECIMALS ,
27
+ ErrorCode ,
27
28
} from '../../../types' ;
28
29
import { parseTransferResult , valueToWei , weiToValue } from '../../../utils/convert' ;
29
30
@@ -153,8 +154,12 @@ export default class PercentageTransferManagerWrapper extends ModuleWrapper {
153
154
} ;
154
155
155
156
public unpause = async ( params : TxParams ) => {
156
- assert . assert ( await this . paused ( ) , 'Controller not currently paused' ) ;
157
- assert . assert ( await this . isCallerTheSecurityTokenOwner ( params . txData ) , 'Sender is not owner' ) ;
157
+ assert . assert ( await this . paused ( ) , ErrorCode . PreconditionRequired , 'Controller not currently paused' ) ;
158
+ assert . assert (
159
+ await this . isCallerTheSecurityTokenOwner ( params . txData ) ,
160
+ ErrorCode . Unauthorized ,
161
+ 'Sender is not owner' ,
162
+ ) ;
158
163
return ( await this . contract ) . unpause . sendTransactionAsync ( params . txData , params . safetyFactor ) ;
159
164
} ;
160
165
@@ -163,8 +168,12 @@ export default class PercentageTransferManagerWrapper extends ModuleWrapper {
163
168
} ;
164
169
165
170
public pause = async ( params : TxParams ) => {
166
- assert . assert ( ! ( await this . paused ( ) ) , 'Controller currently paused' ) ;
167
- assert . assert ( await this . isCallerTheSecurityTokenOwner ( params . txData ) , 'Sender is not owner' ) ;
171
+ assert . assert ( ! ( await this . paused ( ) ) , ErrorCode . ContractPaused , 'Controller currently paused' ) ;
172
+ assert . assert (
173
+ await this . isCallerTheSecurityTokenOwner ( params . txData ) ,
174
+ ErrorCode . Unauthorized ,
175
+ 'Sender is not owner' ,
176
+ ) ;
168
177
return ( await this . contract ) . pause . sendTransactionAsync ( params . txData , params . safetyFactor ) ;
169
178
} ;
170
179
@@ -191,7 +200,11 @@ export default class PercentageTransferManagerWrapper extends ModuleWrapper {
191
200
} ;
192
201
193
202
public changeHolderPercentage = async ( params : ChangeHolderPercentageParams ) => {
194
- assert . assert ( await this . isCallerAllowed ( params . txData , Perm . Admin ) , 'Caller is not allowed' ) ;
203
+ assert . assert (
204
+ await this . isCallerAllowed ( params . txData , Perm . Admin ) ,
205
+ ErrorCode . Unauthorized ,
206
+ 'Caller is not allowed' ,
207
+ ) ;
195
208
assert . isPercentage ( 'maxHolderPercentage' , params . maxHolderPercentage ) ;
196
209
return ( await this . contract ) . changeHolderPercentage . sendTransactionAsync (
197
210
valueToWei ( params . maxHolderPercentage , PERCENTAGE_DECIMALS ) ,
@@ -201,7 +214,11 @@ export default class PercentageTransferManagerWrapper extends ModuleWrapper {
201
214
} ;
202
215
203
216
public modifyWhitelist = async ( params : ModifyWhitelistParams ) => {
204
- assert . assert ( await this . isCallerAllowed ( params . txData , Perm . Admin ) , 'Caller is not allowed' ) ;
217
+ assert . assert (
218
+ await this . isCallerAllowed ( params . txData , Perm . Admin ) ,
219
+ ErrorCode . Unauthorized ,
220
+ 'Caller is not allowed' ,
221
+ ) ;
205
222
assert . isETHAddressHex ( 'investor' , params . investor ) ;
206
223
return ( await this . contract ) . modifyWhitelist . sendTransactionAsync (
207
224
params . investor ,
@@ -212,9 +229,14 @@ export default class PercentageTransferManagerWrapper extends ModuleWrapper {
212
229
} ;
213
230
214
231
public modifyWhitelistMulti = async ( params : ModifyWhitelistMultiParams ) => {
215
- assert . assert ( await this . isCallerAllowed ( params . txData , Perm . Admin ) , 'Caller is not allowed' ) ;
232
+ assert . assert (
233
+ await this . isCallerAllowed ( params . txData , Perm . Admin ) ,
234
+ ErrorCode . Unauthorized ,
235
+ 'Caller is not allowed' ,
236
+ ) ;
216
237
assert . assert (
217
238
params . investors . length === params . valids . length ,
239
+ ErrorCode . MismatchedArrayLength ,
218
240
'Array lengths are not equal for investors and valids' ,
219
241
) ;
220
242
params . investors . forEach ( address => assert . isETHAddressHex ( 'investors' , address ) ) ;
@@ -227,9 +249,14 @@ export default class PercentageTransferManagerWrapper extends ModuleWrapper {
227
249
} ;
228
250
229
251
public setAllowPrimaryIssuance = async ( params : SetAllowPrimaryIssuanceParams ) => {
230
- assert . assert ( await this . isCallerAllowed ( params . txData , Perm . Admin ) , 'Caller is not allowed' ) ;
252
+ assert . assert (
253
+ await this . isCallerAllowed ( params . txData , Perm . Admin ) ,
254
+ ErrorCode . Unauthorized ,
255
+ 'Caller is not allowed' ,
256
+ ) ;
231
257
assert . assert (
232
258
( await this . allowPrimaryIssuance ( ) ) !== params . allowPrimaryIssuance ,
259
+ ErrorCode . PreconditionRequired ,
233
260
'AllowPrimaryIssuance value must change ' ,
234
261
) ;
235
262
return ( await this . contract ) . setAllowPrimaryIssuance . sendTransactionAsync (
0 commit comments