@@ -263,7 +263,7 @@ contract("{Set}", (accounts) => {
263
263
) ;
264
264
} ) ;
265
265
} ) ;
266
-
266
+
267
267
describe ( "of overflow units" , async ( ) => {
268
268
it ( "should disallow issuing a quantity of tokens that would trigger an overflow" , async ( ) => {
269
269
const overflowUnits = gWei ( 2 ) . div ( 5 ) ;
@@ -295,7 +295,7 @@ contract("{Set}", (accounts) => {
295
295
} ) ;
296
296
297
297
describe ( "Partial Redemption" , async ( ) => {
298
- const quantityIssued = new BigNumber ( 10 ) ;
298
+ const quantityIssued = ether ( 10 ) ;
299
299
let quantityA : BigNumber ;
300
300
let quantityB : BigNumber ;
301
301
@@ -343,4 +343,47 @@ contract("{Set}", (accounts) => {
343
343
expect ( postRedeemBalanceBofOwner ) . to . be . bignumber . equal ( initialTokens , "Post Balance B" ) ;
344
344
} ) ;
345
345
} ) ;
346
+
347
+ describe ( "Redeem Excluded" , async ( ) => {
348
+ const quantityIssued = ether ( 10 ) ;
349
+ let quantityA : BigNumber ;
350
+ let quantityB : BigNumber ;
351
+
352
+ // Create a Set two components with set tokens issued
353
+ beforeEach ( async ( ) => {
354
+ componentA = await StandardTokenMock . new ( testAccount , initialTokens , "Component A" , "A" ) ;
355
+ componentB = await StandardTokenMock . new ( testAccount , initialTokens , "Component B" , "B" ) ;
356
+
357
+ setToken = await SetToken . new (
358
+ [ componentA . address , componentB . address ] ,
359
+ [ unitsA , unitsB ] ,
360
+ TX_DEFAULTS ,
361
+ ) ;
362
+
363
+ // Expected Quantities of tokens moved are divided by a gWei
364
+ // to reflect the new units in set instantiation
365
+ quantityA = unitsA . mul ( quantityIssued ) . div ( gWei ( 1 ) ) ;
366
+ quantityB = unitsB . mul ( quantityIssued ) . div ( gWei ( 1 ) ) ;
367
+
368
+ await componentA . approve ( setToken . address , quantityA , TX_DEFAULTS ) ;
369
+ await componentB . approve ( setToken . address , quantityB , TX_DEFAULTS ) ;
370
+
371
+ await setToken . issue ( quantityIssued , TX_DEFAULTS ) ;
372
+
373
+ // Perform a partial redeem
374
+ await setToken . partialRedeem ( quantityIssued , [ componentA . address ] , TX_DEFAULTS ) ;
375
+ } ) ;
376
+
377
+ it ( "should successfully redeem excluded a standard Set" , async ( ) => {
378
+ await setToken . redeemExcluded ( quantityA , componentA . address , TX_DEFAULTS ) ;
379
+
380
+ // The user should have a balance of TokenA
381
+ const postRedeemBalanceAofOwner = await componentA . balanceOf ( testAccount ) ;
382
+ expect ( postRedeemBalanceAofOwner ) . to . be . bignumber . equal ( initialTokens ) ;
383
+
384
+ // The user should have no balance of Token A in excluded Tokens
385
+ const [ excludedBalanceAofOwner ] = await setToken . unredeemedComponents ( componentA . address , testAccount ) ;
386
+ expect ( excludedBalanceAofOwner ) . to . be . bignumber . equal ( 0 ) ;
387
+ } ) ;
388
+ } ) ;
346
389
} ) ;
0 commit comments