diff --git a/typescript/event-attestator/src/ProofcastEventAttestator.ts b/typescript/event-attestator/src/ProofcastEventAttestator.ts index 0cef79df..e0c04089 100644 --- a/typescript/event-attestator/src/ProofcastEventAttestator.ts +++ b/typescript/event-attestator/src/ProofcastEventAttestator.ts @@ -61,14 +61,11 @@ export class ProofcastEventAttestator { getEventPayload(event: Event): string { // EVM event support only: for other chains may be // required to change logic based on version and protocolID - return hexConcat([ - hexZeroPad(event.address, 32), - event.topics[0], - event.topics[1], - hexZeroPad('0x00', 32), - hexZeroPad('0x00', 32), - event.data, - ]) + const topics = [0, 1, 2, 3].map( + i => event.topics[i] || hexZeroPad('0x00', 32), + ) + + return hexConcat([hexZeroPad(event.address, 32), ...topics, event.data]) } getEventContext(): string {