Added eventIndex in tests.

This commit is contained in:
Maria Carmina 2023-03-15 22:56:03 +02:00
parent ba51470a82
commit ec88556879
11 changed files with 45 additions and 32 deletions

View File

@ -499,7 +499,6 @@ type VeOCEAN @entity {
claims: [VeClaim!] @derivedFrom(field: "veOcean")
allocation: VeAllocateUser @derivedFrom(field: "veOcean")
block: Int!
eventIndex: BigInt!
}
type VeDeposit @entity {

View File

@ -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()
}

View File

@ -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()
}

View File

@ -159,6 +159,7 @@ describe('DFRewards tests', async () => {
}
type
tx
eventIndex
}
}
}`
@ -219,6 +220,7 @@ describe('DFRewards tests', async () => {
}
type
tx
eventIndex
}
}
}`

View File

@ -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)

View File

@ -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, {

View File

@ -50,6 +50,7 @@ async function getSubgraphApprovedTokens() {
id
}
}
eventIndex
}`
}
const initialResponse = await fetch(subgraphUrl, {

View File

@ -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, {

View File

@ -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',

View File

@ -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)

View File

@ -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, {