@@ -230,7 +230,7 @@ describe('e2e_token_contract', () => {
230
230
it ( 'as minter' , async ( ) => {
231
231
const amount = 10000n ;
232
232
const tx = asset . methods
233
- . mint_pub ( { address : accounts [ 0 ] . address } , amount )
233
+ . mint_public ( { address : accounts [ 0 ] . address } , amount )
234
234
. send ( { origin : accounts [ 0 ] . address } ) ;
235
235
const receipt = await tx . wait ( ) ;
236
236
expect ( receipt . status ) . toBe ( TxStatus . MINED ) ;
@@ -246,28 +246,36 @@ describe('e2e_token_contract', () => {
246
246
it ( 'as non-minter' , async ( ) => {
247
247
const amount = 10000n ;
248
248
await expect (
249
- asset . methods . mint_pub ( { address : accounts [ 0 ] . address } , amount ) . simulate ( { origin : accounts [ 1 ] . address } ) ,
249
+ asset . methods
250
+ . mint_public ( { address : accounts [ 0 ] . address } , amount )
251
+ . simulate ( { origin : accounts [ 1 ] . address } ) ,
250
252
) . rejects . toThrowError ( 'Assertion failed: caller is not minter' ) ;
251
253
} ) ;
252
254
253
255
it ( 'mint >u120 tokens to overflow' , async ( ) => {
254
256
const amount = 2n ** 120n ; // SafeU120::max() + 1;
255
257
await expect (
256
- asset . methods . mint_pub ( { address : accounts [ 0 ] . address } , amount ) . simulate ( { origin : accounts [ 0 ] . address } ) ,
258
+ asset . methods
259
+ . mint_public ( { address : accounts [ 0 ] . address } , amount )
260
+ . simulate ( { origin : accounts [ 0 ] . address } ) ,
257
261
) . rejects . toThrowError ( 'Assertion failed: Value too large for SafeU120' ) ;
258
262
} ) ;
259
263
260
264
it ( 'mint <u120 but recipient balance >u120' , async ( ) => {
261
265
const amount = 2n ** 120n - tokenSim . balanceOfPublic ( accounts [ 0 ] . address ) ;
262
266
await expect (
263
- asset . methods . mint_pub ( { address : accounts [ 0 ] . address } , amount ) . simulate ( { origin : accounts [ 0 ] . address } ) ,
267
+ asset . methods
268
+ . mint_public ( { address : accounts [ 0 ] . address } , amount )
269
+ . simulate ( { origin : accounts [ 0 ] . address } ) ,
264
270
) . rejects . toThrowError ( 'Assertion failed: Overflow' ) ;
265
271
} ) ;
266
272
267
273
it ( 'mint <u120 but such that total supply >u120' , async ( ) => {
268
274
const amount = 2n ** 120n - tokenSim . balanceOfPublic ( accounts [ 0 ] . address ) ;
269
275
await expect (
270
- asset . methods . mint_pub ( { address : accounts [ 1 ] . address } , amount ) . simulate ( { origin : accounts [ 0 ] . address } ) ,
276
+ asset . methods
277
+ . mint_public ( { address : accounts [ 1 ] . address } , amount )
278
+ . simulate ( { origin : accounts [ 0 ] . address } ) ,
271
279
) . rejects . toThrowError ( 'Assertion failed: Overflow' ) ;
272
280
} ) ;
273
281
} ) ;
@@ -284,7 +292,7 @@ describe('e2e_token_contract', () => {
284
292
285
293
describe ( 'Mint flow' , ( ) => {
286
294
it ( 'mint_private as minter' , async ( ) => {
287
- const tx = asset . methods . mint_priv ( amount , secretHash ) . send ( { origin : accounts [ 0 ] . address } ) ;
295
+ const tx = asset . methods . mint_private ( amount , secretHash ) . send ( { origin : accounts [ 0 ] . address } ) ;
288
296
const receipt = await tx . wait ( ) ;
289
297
expect ( receipt . status ) . toBe ( TxStatus . MINED ) ;
290
298
tokenSim . mintPrivate ( accounts [ 0 ] . address , amount ) ;
@@ -312,28 +320,28 @@ describe('e2e_token_contract', () => {
312
320
313
321
it ( 'mint_private as non-minter' , async ( ) => {
314
322
await expect (
315
- asset . methods . mint_priv ( amount , secretHash ) . simulate ( { origin : accounts [ 1 ] . address } ) ,
323
+ asset . methods . mint_private ( amount , secretHash ) . simulate ( { origin : accounts [ 1 ] . address } ) ,
316
324
) . rejects . toThrowError ( 'Assertion failed: caller is not minter' ) ;
317
325
} ) ;
318
326
319
327
it ( 'mint >u120 tokens to overflow' , async ( ) => {
320
328
const amount = 2n ** 120n ; // SafeU120::max() + 1;
321
329
await expect (
322
- asset . methods . mint_priv ( amount , secretHash ) . simulate ( { origin : accounts [ 0 ] . address } ) ,
330
+ asset . methods . mint_private ( amount , secretHash ) . simulate ( { origin : accounts [ 0 ] . address } ) ,
323
331
) . rejects . toThrowError ( 'Assertion failed: Value too large for SafeU120' ) ;
324
332
} ) ;
325
333
326
334
it ( 'mint <u120 but recipient balance >u120' , async ( ) => {
327
335
const amount = 2n ** 120n - tokenSim . balanceOfPrivate ( accounts [ 0 ] . address ) ;
328
336
await expect (
329
- asset . methods . mint_priv ( amount , secretHash ) . simulate ( { origin : accounts [ 0 ] . address } ) ,
337
+ asset . methods . mint_private ( amount , secretHash ) . simulate ( { origin : accounts [ 0 ] . address } ) ,
330
338
) . rejects . toThrowError ( 'Assertion failed: Overflow' ) ;
331
339
} ) ;
332
340
333
341
it ( 'mint <u120 but such that total supply >u120' , async ( ) => {
334
342
const amount = 2n ** 120n - tokenSim . totalSupply ;
335
343
await expect (
336
- asset . methods . mint_priv ( amount , secretHash ) . simulate ( { origin : accounts [ 0 ] . address } ) ,
344
+ asset . methods . mint_private ( amount , secretHash ) . simulate ( { origin : accounts [ 0 ] . address } ) ,
337
345
) . rejects . toThrowError ( 'Assertion failed: Overflow' ) ;
338
346
} ) ;
339
347
} ) ;
0 commit comments