diff --git a/schema.graphql b/schema.graphql index 0377259..003fb30 100644 --- a/schema.graphql +++ b/schema.graphql @@ -499,7 +499,6 @@ type VeOCEAN @entity { claims: [VeClaim!] @derivedFrom(field: "veOcean") allocation: VeAllocateUser @derivedFrom(field: "veOcean") block: Int! - eventIndex: BigInt! } type VeDeposit @entity { diff --git a/src/mappings/utils/veUtils.ts b/src/mappings/utils/veUtils.ts index 3f84a5b..25e6cd6 100644 --- a/src/mappings/utils/veUtils.ts +++ b/src/mappings/utils/veUtils.ts @@ -21,7 +21,6 @@ export function getveOCEAN(id: string): VeOCEAN { ve.unlockTime = BigInt.zero() ve.lockedAmount = BigDecimal.zero() ve.block = 0 - ve.eventIndex = BigInt.zero() ve.save() } diff --git a/src/mappings/veOCEAN.ts b/src/mappings/veOCEAN.ts index 49d0a4e..ae0edad 100644 --- a/src/mappings/veOCEAN.ts +++ b/src/mappings/veOCEAN.ts @@ -36,7 +36,6 @@ export function handleDeposit(event: Deposit): void { veOCEAN.unlockTime = locktime veOCEAN.lockedAmount = veOCEAN.lockedAmount.plus(lockedAmount) veOCEAN.block = event.block.number.toI32() - veOCEAN.eventIndex = event.logIndex veOCEAN.save() } export function handleSupply(event: Supply): void {} @@ -70,6 +69,5 @@ export function handleWithdraw(event: Withdraw): void { veOCEAN.lockedAmount = BigDecimal.zero() veOCEAN.unlockTime = BigInt.zero() veOCEAN.block = event.block.number.toI32() - veOCEAN.eventIndex = event.logIndex veOCEAN.save() } diff --git a/test/integration/DFRewards.test.ts b/test/integration/DFRewards.test.ts index 2c9e97f..733eaa8 100644 --- a/test/integration/DFRewards.test.ts +++ b/test/integration/DFRewards.test.ts @@ -159,6 +159,7 @@ describe('DFRewards tests', async () => { } type tx + eventIndex } } }` @@ -219,6 +220,7 @@ describe('DFRewards tests', async () => { } type tx + eventIndex } } }` diff --git a/test/integration/Datatoken.test.ts b/test/integration/Datatoken.test.ts index dc3f879..eac0bf9 100644 --- a/test/integration/Datatoken.test.ts +++ b/test/integration/Datatoken.test.ts @@ -162,7 +162,8 @@ describe('Datatoken tests', async () => { createdTimestamp, tx, block, - lastPriceValue + lastPriceValue, + eventIndex }}` } const initialResponse = await fetch(subgraphUrl, { @@ -272,7 +273,8 @@ describe('Datatoken tests', async () => { createdTimestamp, tx, block, - lastPriceValue + lastPriceValue, + eventIndex }}` } const initialResponse = await fetch(subgraphUrl, { @@ -362,7 +364,7 @@ describe('Datatoken tests', async () => { assert(Number(user2balance) === 0, 'Invalid user2 balance') const query = { - query: `query {token(id: "${newDtAddress.toLowerCase()}"){id,orderCount,orders {id, nftOwner{id}, lastPriceToken{id}}}}` + query: `query {token(id: "${newDtAddress.toLowerCase()}"){id,orderCount,orders {id, nftOwner{id}, lastPriceToken{id}},eventIndex}}` } await sleep(2000) diff --git a/test/integration/Dispenser.test.ts b/test/integration/Dispenser.test.ts index 763ffe8..1e366db 100644 --- a/test/integration/Dispenser.test.ts +++ b/test/integration/Dispenser.test.ts @@ -139,7 +139,8 @@ describe('Dispenser tests', async () => { createdTimestamp, tx, block, - orderCount}}` + orderCount, + eventIndex}}` } const initialResponse = await fetch(subgraphUrl, { method: 'POST', @@ -202,7 +203,8 @@ describe('Dispenser tests', async () => { createdTimestamp, tx, block, - lastPriceValue + lastPriceValue, + eventIndex }}` } const dtResponse = await fetch(subgraphUrl, { @@ -262,7 +264,7 @@ describe('Dispenser tests', async () => { assert((await datatoken.getPermissions(dtAddress, user1)).minter === true) await sleep(sleepMs) const minterQuery = { - query: `query {token(id: "${dtAddress}"){minter{id}}}` + query: `query {token(id: "${dtAddress}"){minter{id},eventIndex}}` } const minterResponse = await fetch(subgraphUrl, { @@ -313,6 +315,7 @@ describe('Dispenser tests', async () => { dispenses { id } + eventIndex __typename }}` } @@ -342,7 +345,7 @@ describe('Dispenser tests', async () => { it('Deactivates dispenser', async () => { const deactiveQuery = { - query: `query {dispenser(id: "${dispenserId}"){active}}` + query: `query {dispenser(id: "${dispenserId}"){active,eventIndex}}` } const initialResponse = await fetch(subgraphUrl, { @@ -368,7 +371,7 @@ describe('Dispenser tests', async () => { it('Activates exchange', async () => { const activeQuery = { - query: `query {dispenser(id: "${dispenserId}"){active}}` + query: `query {dispenser(id: "${dispenserId}"){active,eventIndex}}` } const initialResponse = await fetch(subgraphUrl, { method: 'POST', @@ -402,6 +405,7 @@ describe('Dispenser tests', async () => { block createdTimestamp tx + eventIndex __typename }}}` } @@ -440,7 +444,7 @@ describe('Dispenser tests', async () => { // Check balance after owner withdraw const balanceQuery = { - query: `query {dispenser(id: "${dispenserId}"){balance}}` + query: `query {dispenser(id: "${dispenserId}"){balance,eventIndex}}` } const response = await fetch(subgraphUrl, { @@ -454,7 +458,7 @@ describe('Dispenser tests', async () => { it('Updates allowed swapper', async () => { const swapperQuery = { - query: `query {dispenser(id: "${dispenserId}"){allowedSwapper}}` + query: `query {dispenser(id: "${dispenserId}"){allowedSwapper,eventIndex}}` } // Check initial allowedSwapper const swapperResponse1 = await fetch(subgraphUrl, { diff --git a/test/integration/FactoryRouter.test.ts b/test/integration/FactoryRouter.test.ts index 0c03b85..8109815 100644 --- a/test/integration/FactoryRouter.test.ts +++ b/test/integration/FactoryRouter.test.ts @@ -50,6 +50,7 @@ async function getSubgraphApprovedTokens() { id } } + eventIndex }` } const initialResponse = await fetch(subgraphUrl, { diff --git a/test/integration/FixedRateExchange.test.ts b/test/integration/FixedRateExchange.test.ts index 278f4cd..7fb79d5 100644 --- a/test/integration/FixedRateExchange.test.ts +++ b/test/integration/FixedRateExchange.test.ts @@ -152,7 +152,8 @@ describe('Fixed Rate Exchange tests', async () => { createdTimestamp, tx, block, - orderCount}}` + orderCount, + eventIndex}}` } const initialResponse = await fetch(subgraphUrl, { method: 'POST', @@ -222,7 +223,8 @@ describe('Fixed Rate Exchange tests', async () => { tx, block, lastPriceToken, - lastPriceValue + lastPriceValue, + eventIndex }}` } const dtResponse = await fetch(subgraphUrl, { @@ -312,7 +314,8 @@ describe('Fixed Rate Exchange tests', async () => { tx block publishMarketFeeAddress - publishMarketSwapFee + publishMarketSwapFee, + eventIndex } }` } @@ -398,6 +401,7 @@ describe('Fixed Rate Exchange tests', async () => { } oldPrice newPrice + eventIndex } }}` } @@ -467,7 +471,7 @@ describe('Fixed Rate Exchange tests', async () => { }) it('Deactivates exchange', async () => { const deactiveQuery = { - query: `query {fixedRateExchange(id: "${fixedRateId}"){active}}` + query: `query {fixedRateExchange(id: "${fixedRateId}"){active,eventIndex}}` } const initialResponse = await fetch(subgraphUrl, { @@ -494,7 +498,7 @@ describe('Fixed Rate Exchange tests', async () => { it('Activates exchange', async () => { const activeQuery = { - query: `query {fixedRateExchange(id: "${fixedRateId}"){active}}` + query: `query {fixedRateExchange(id: "${fixedRateId}"){active,eventIndex}}` } const initialResponse = await fetch(subgraphUrl, { method: 'POST', @@ -520,7 +524,7 @@ describe('Fixed Rate Exchange tests', async () => { it('Activate Minting', async () => { const mintingQuery = { - query: `query {fixedRateExchange(id: "${fixedRateId}"){withMint}}` + query: `query {fixedRateExchange(id: "${fixedRateId}"){withMint,eventIndex}}` } const initialResponse = await fetch(subgraphUrl, { method: 'POST', @@ -547,7 +551,7 @@ describe('Fixed Rate Exchange tests', async () => { it('Deactivate Minting', async () => { const mintingQuery = { - query: `query {fixedRateExchange(id: "${fixedRateId}"){withMint}}` + query: `query {fixedRateExchange(id: "${fixedRateId}"){withMint,eventIndex}}` } const initialResponse = await fetch(subgraphUrl, { method: 'POST', @@ -587,6 +591,7 @@ describe('Fixed Rate Exchange tests', async () => { oceanFeeAmount marketFeeAmount consumeMarketFeeAmount + eventIndex __typename } }}` @@ -692,6 +697,7 @@ describe('Fixed Rate Exchange tests', async () => { createdTimestamp tx oceanFeeAmount + eventIndex __typename } }}` @@ -720,7 +726,7 @@ describe('Fixed Rate Exchange tests', async () => { it('Updates allowed swapper', async () => { const swapperQuery = { - query: `query {fixedRateExchange(id: "${fixedRateId}"){allowedSwapper}}` + query: `query {fixedRateExchange(id: "${fixedRateId}"){allowedSwapper,eventIndex}}` } // Check initial allowedSwapper const swapperResponse1 = await fetch(subgraphUrl, { diff --git a/test/integration/Nft.test.ts b/test/integration/Nft.test.ts index 2c96dfe..b94f1e0 100644 --- a/test/integration/Nft.test.ts +++ b/test/integration/Nft.test.ts @@ -144,7 +144,8 @@ describe('NFT tests', async () => { createdTimestamp, tx, block, - orderCount}}` + orderCount, + eventIndex}}` } const initialResponse = await fetch(subgraphUrl, { method: 'POST', @@ -233,7 +234,8 @@ describe('NFT tests', async () => { createdTimestamp, tx, block, - orderCount}}` + orderCount, + eventIndex}}` } const response = await fetch(subgraphUrl, { method: 'POST', diff --git a/test/integration/SimplePublishConsume.test.ts b/test/integration/SimplePublishConsume.test.ts index 79071a4..41b2a06 100644 --- a/test/integration/SimplePublishConsume.test.ts +++ b/test/integration/SimplePublishConsume.test.ts @@ -152,7 +152,7 @@ describe('Simple Publish & consume test', async () => { const graphNftToken = erc721Address.toLowerCase() const query = { query: `query { - nft(id:"${graphNftToken}"){symbol,id}}` + nft(id:"${graphNftToken}"){symbol,id,eventIndex}}` } const response = await fetch(subgraphUrl, { method: 'POST', @@ -191,7 +191,7 @@ describe('Simple Publish & consume test', async () => { const queryOriginalOwner = { query: `query { - nft(id:"${graphNftToken}"){symbol,id,owner{id}}}` + nft(id:"${graphNftToken}"){symbol,id,owner{id},eventIndex}}` } const initialResponse = await fetch(subgraphUrl, { method: 'POST', @@ -235,7 +235,7 @@ describe('Simple Publish & consume test', async () => { await sleep(2000) const query2 = { query: `query { - nft(id:"${graphNftToken}"){symbol,id,owner{id}, transferable}}` + nft(id:"${graphNftToken}"){symbol,id,owner{id}, transferable,eventIndex}}` } const response = await fetch(subgraphUrl, { method: 'POST', @@ -283,7 +283,7 @@ describe('Simple Publish & consume test', async () => { const orderId = `${orderTx.transactionHash.toLowerCase()}-${datatokenAddress.toLowerCase()}-${user1.toLowerCase()}` const query = { - query: `query {order(id:"${orderId}"){id, providerFee, lastPriceToken{id}}}` + query: `query {order(id:"${orderId}"){id, providerFee, lastPriceToken{id}, eventIndex}}` } await sleep(2000) @@ -357,7 +357,7 @@ describe('Simple Publish & consume test', async () => { const orderId = `${orderTx.transactionHash.toLowerCase()}-${datatokenAddress.toLowerCase()}-${user4.toLowerCase()}` const initialQuery = { - query: `query {order(id:"${orderId}"){id, providerFee, lastPriceToken{id}}}` + query: `query {order(id:"${orderId}"){id, providerFee, lastPriceToken{id}, eventIndex}}` } await sleep(2000) const initialResponse = await fetch(subgraphUrl, { @@ -426,7 +426,7 @@ describe('Simple Publish & consume test', async () => { // Check the new provider fee has been set in OrderReuse const reuseQuery = { - query: `query {orderReuse(id:"${reusedOrder.transactionHash}"){id, providerFee}}` + query: `query {orderReuse(id:"${reusedOrder.transactionHash}"){id, providerFee, eventIndex}}` } await sleep(2000) diff --git a/test/integration/SimpleSubgraph.test.ts b/test/integration/SimpleSubgraph.test.ts index 83a1a28..61ec47d 100644 --- a/test/integration/SimpleSubgraph.test.ts +++ b/test/integration/SimpleSubgraph.test.ts @@ -73,7 +73,7 @@ describe('Tests coverage without provider/aquarius', async () => { const graphNftToken = erc721Address.toLowerCase() const query = { query: `query { - nft(id:"${graphNftToken}"){symbol,id}}` + nft(id:"${graphNftToken}"){symbol,id,eventIndex}}` } const response = await fetch(subgraphUrl, { method: 'POST', @@ -125,7 +125,7 @@ describe('Tests coverage without provider/aquarius', async () => { id, owner{id}, transferable, - transferHistory(orderBy: timestamp, orderDirection: desc){id,nft,oldOwner,newOwner,txId,timestamp,block} + transferHistory(orderBy: timestamp, orderDirection: desc){id,nft,oldOwner,newOwner,txId,timestamp,block,eventIndex} }}` } const response = await fetch(subgraphUrl, {