Generated dispenser transaction with event index.

This commit is contained in:
Maria Carmina 2023-04-24 16:57:48 +03:00
parent 0b377b8e02
commit 11924c3489
4 changed files with 10 additions and 6 deletions

View File

@ -74,6 +74,7 @@ jobs:
npm run test-publish-consume
npm run test-dt
npm run test-fixed
npm run test-dispenser
env:
ADDRESS_FILE: /home/runner/.ocean/ocean-contracts/artifacts/address.json
BARGE_FOLDER: /home/runner/.ocean/

View File

@ -88,10 +88,8 @@ export function handleTokensDispensed(event: TokensDispensed): void {
event.address,
event.params.datatokenAddress
)
const id = event.transaction.hash
.toHexString()
.concat('-')
.concat(dispenserID)
const eventIndex: number = event.logIndex.toI32()
const id = `${event.transaction.hash.toHexString()}-${dispenserID}-${eventIndex}`
const dispenserTransaction = new DispenserTransaction(id)
const dispenser = getDispenser(dispenserID)

View File

@ -170,7 +170,6 @@ export function handleAllowedSwapperChanged(
// TODO: implement market fee, opf fee
export function handleSwap(event: Swapped): void {
// TODO
const fixedRateId = getFixedRateGraphID(
event.params.exchangeId.toHexString(),
event.address

View File

@ -453,7 +453,13 @@ describe('Dispenser tests', async () => {
})
const dispense = (await response2.json()).data.dispenser.dispenses[0]
assert(dispense.id === `${tx.transactionHash}-${dispenserId}`, 'wrong id')
assert(
dispense.id ===
`${
tx.transactionHash
}-${dispenserId}-${tx.events.TokensDispensed.logIndex.toFixed(1)}`,
'wrong id'
)
assert(dispense.dispenser.id === dispenserId, 'incorrect value for: user')
assert(dispense.user.id === user2, 'incorrect value for: user')
assert(dispense.amount === amount, 'incorrect value for: user')