@@ -311,7 +311,7 @@ describe('Curation', () => {
311
311
await controller
312
312
. connect ( governor . signer )
313
313
. setContractProxy ( utils . id ( 'Staking' ) , stakingMock . address )
314
- await curation . syncAllContracts ( )
314
+ await curation . syncAllContracts ( ) // call sync because we change the proxy for staking
315
315
316
316
const tx = curation
317
317
. connect ( stakingMock . signer )
@@ -334,7 +334,7 @@ describe('Curation', () => {
334
334
await controller
335
335
. connect ( governor . signer )
336
336
. setContractProxy ( utils . id ( 'Staking' ) , stakingMock . address )
337
- await curation . syncAllContracts ( )
337
+ await curation . syncAllContracts ( ) // call sync because we change the proxy for staking
338
338
339
339
await shouldCollect ( toGRT ( '1' ) )
340
340
await shouldCollect ( toGRT ( '10' ) )
@@ -347,7 +347,7 @@ describe('Curation', () => {
347
347
await controller
348
348
. connect ( governor . signer )
349
349
. setContractProxy ( utils . id ( 'Staking' ) , stakingMock . address )
350
- await curation . syncAllContracts ( )
350
+ await curation . syncAllContracts ( ) // call sync because we change the proxy for staking
351
351
352
352
// Collect increase the pool reserves
353
353
await shouldCollect ( toGRT ( '100' ) )
@@ -359,6 +359,42 @@ describe('Curation', () => {
359
359
)
360
360
await shouldBurn ( signalToRedeem , toGRT ( '1100' ) )
361
361
} )
362
+
363
+ it ( 'should collect tokens and then unsignal multiple times' , async function ( ) {
364
+ await controller
365
+ . connect ( governor . signer )
366
+ . setContractProxy ( utils . id ( 'Staking' ) , stakingMock . address )
367
+ await curation . syncAllContracts ( ) // call sync because we change the proxy for staking
368
+
369
+ // Collect increase the pool reserves
370
+ const tokensToCollect = toGRT ( '100' )
371
+ await shouldCollect ( tokensToCollect )
372
+
373
+ // Unsignal partially
374
+ const signalOutRemainder = toGRT ( 1 )
375
+ const signalOutPartial = (
376
+ await curation . getCuratorSignal ( curator . address , subgraphDeploymentID )
377
+ ) . sub ( signalOutRemainder )
378
+ const tx1 = await curation
379
+ . connect ( curator . signer )
380
+ . burn ( subgraphDeploymentID , signalOutPartial , 0 )
381
+ const r1 = await tx1 . wait ( )
382
+ const event1 = curation . interface . parseLog ( r1 . events [ 2 ] ) . args
383
+ const tokensOut1 = event1 . tokens
384
+
385
+ // Collect increase the pool reserves
386
+ await shouldCollect ( tokensToCollect )
387
+
388
+ // Unsignal the rest
389
+ const tx2 = await curation
390
+ . connect ( curator . signer )
391
+ . burn ( subgraphDeploymentID , signalOutRemainder , 0 )
392
+ const r2 = await tx2 . wait ( )
393
+ const event2 = curation . interface . parseLog ( r2 . events [ 2 ] ) . args
394
+ const tokensOut2 = event2 . tokens
395
+
396
+ expect ( tokensOut1 . add ( tokensOut2 ) ) . eq ( toGRT ( '1000' ) . add ( tokensToCollect . mul ( 2 ) ) )
397
+ } )
362
398
} )
363
399
} )
364
400
0 commit comments