Skip to content

Commit 13f4ac5

Browse files
committed
curation: add an additional test combination for curation
1 parent c4ee6d7 commit 13f4ac5

File tree

1 file changed

+39
-3
lines changed

1 file changed

+39
-3
lines changed

test/curation/curation.test.ts

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ describe('Curation', () => {
311311
await controller
312312
.connect(governor.signer)
313313
.setContractProxy(utils.id('Staking'), stakingMock.address)
314-
await curation.syncAllContracts()
314+
await curation.syncAllContracts() // call sync because we change the proxy for staking
315315

316316
const tx = curation
317317
.connect(stakingMock.signer)
@@ -334,7 +334,7 @@ describe('Curation', () => {
334334
await controller
335335
.connect(governor.signer)
336336
.setContractProxy(utils.id('Staking'), stakingMock.address)
337-
await curation.syncAllContracts()
337+
await curation.syncAllContracts() // call sync because we change the proxy for staking
338338

339339
await shouldCollect(toGRT('1'))
340340
await shouldCollect(toGRT('10'))
@@ -347,7 +347,7 @@ describe('Curation', () => {
347347
await controller
348348
.connect(governor.signer)
349349
.setContractProxy(utils.id('Staking'), stakingMock.address)
350-
await curation.syncAllContracts()
350+
await curation.syncAllContracts() // call sync because we change the proxy for staking
351351

352352
// Collect increase the pool reserves
353353
await shouldCollect(toGRT('100'))
@@ -359,6 +359,42 @@ describe('Curation', () => {
359359
)
360360
await shouldBurn(signalToRedeem, toGRT('1100'))
361361
})
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+
})
362398
})
363399
})
364400

0 commit comments

Comments
 (0)