Skip to main content
Version: Current

Data decoding

Decoding events:

import * as depositsAbi from './abi/deposits'

processor.run(new TypeormDatabase(), async (ctx) => {
for (let c of ctx.blocks) {
for (let log of c.logs) {
if (log.address === CONTRACT_ADDRESS &&
log.topics[0] == depositsAbi.events.Deposit.topic) {

// type-safe decoding of the Deposit event data
const amt = depositsAbi.events.Deposit.decode(log).wad
}
}
}
})

Similar to events, transaction access is provided by the functions object for each contract method defined in the ABI.