diff --git a/README.md b/README.md index 8819fb2..3d52572 100644 --- a/README.md +++ b/README.md @@ -171,5 +171,11 @@ type ConnectorEvent @entity { eventCode: Bytes! eventData: Bytes! + + tx_hash: String! + + block: BigInt! + + logIndex: BigInt! } ``` diff --git a/schema.graphql b/schema.graphql index 9aa7085..44d05dc 100644 --- a/schema.graphql +++ b/schema.graphql @@ -130,6 +130,12 @@ type Cast @entity { sender: Bytes! value: BigInt! + + tx_hash: String! + + block: BigInt! + + logIndex: BigInt! } interface SmartAccountEvent { @@ -137,6 +143,12 @@ interface SmartAccountEvent { "Account scope of the event" account: SmartAccount! + + tx_hash: String! + + block: BigInt! + + logIndex: BigInt! } type CastEvent implements SmartAccountEvent @entity { @@ -149,6 +161,12 @@ type CastEvent implements SmartAccountEvent @entity { sender: Bytes! value: BigInt! + + tx_hash: String! + + block: BigInt! + + logIndex: BigInt! } type DisableEvent implements SmartAccountEvent @entity { @@ -157,6 +175,12 @@ type DisableEvent implements SmartAccountEvent @entity { account: SmartAccount! user: User! + + tx_hash: String! + + block: BigInt! + + logIndex: BigInt! } type EnableEvent implements SmartAccountEvent @entity { @@ -165,6 +189,12 @@ type EnableEvent implements SmartAccountEvent @entity { account: SmartAccount! user: User! + + tx_hash: String! + + block: BigInt! + + logIndex: BigInt! } type SwitchShieldEvent implements SmartAccountEvent @entity { @@ -173,6 +203,12 @@ type SwitchShieldEvent implements SmartAccountEvent @entity { account: SmartAccount! shield: Boolean! + + tx_hash: String! + + block: BigInt! + + logIndex: BigInt! } type ConnectorEvent @entity { @@ -185,4 +221,10 @@ type ConnectorEvent @entity { eventCode: Bytes! eventData: Bytes! + + tx_hash: String! + + block: BigInt! + + logIndex: BigInt! } diff --git a/src/mappings/instaAccount.ts b/src/mappings/instaAccount.ts index b75e16f..8d738a4 100644 --- a/src/mappings/instaAccount.ts +++ b/src/mappings/instaAccount.ts @@ -42,11 +42,17 @@ export function handleLogCast(event: LogCast): void { castEvent.origin = event.params.origin; castEvent.sender = event.params.sender; castEvent.value = event.params.value; + castEvent.tx_hash = event.transaction.hash.toHexString(); + castEvent.block = event.block.number; + castEvent.logIndex = event.logIndex; cast.account = account.id; cast.origin = event.params.origin; cast.sender = event.params.sender; cast.value = event.params.value; + cast.tx_hash = event.transaction.hash.toHexString(); + cast.block = event.block.number; + cast.logIndex = event.logIndex; castEvent.save(); cast.save(); @@ -74,6 +80,9 @@ export function handleLogDisableSmartAccountOwner(event: LogDisable): void { let disableEvent = getOrCreateDisableEvent(eventId); disableEvent.account = account.id; disableEvent.user = user.id; + disableEvent.tx_hash = event.transaction.hash.toHexString(); + disableEvent.block = event.block.number; + disableEvent.logIndex = event.logIndex; account.owner = user.id; account.isEnabled = false; @@ -104,6 +113,9 @@ export function handleLogEnableSmartAccountOwner(event: LogEnable): void { let enableEvent = getOrCreateEnableEvent(eventId); enableEvent.account = account.id; enableEvent.user = user.id; + enableEvent.tx_hash = event.transaction.hash.toHexString(); + enableEvent.block = event.block.number; + enableEvent.logIndex = event.logIndex; account.owner = user.id; account.isEnabled = true; @@ -132,9 +144,11 @@ export function handleLogSwitchShield(event: LogSwitchShield): void { .concat("-") .concat(event.logIndex.toString()); let switchEvent = getOrCreateSwitchShieldEvent(eventId); - switchEvent.account = account.id; switchEvent.shield = event.params._shield; + switchEvent.tx_hash = event.transaction.hash.toHexString(); + switchEvent.block = event.block.number; + switchEvent.logIndex = event.logIndex; account.shield = event.params._shield; diff --git a/src/mappings/instaConnectors.ts b/src/mappings/instaConnectors.ts index 368ee73..c91e068 100644 --- a/src/mappings/instaConnectors.ts +++ b/src/mappings/instaConnectors.ts @@ -132,6 +132,9 @@ export function handleLogEvent(event: LogEvent): void { connectorEvent.connector = connector.id; connectorEvent.eventCode = event.params.eventCode; connectorEvent.eventData = event.params.eventData; + connectorEvent.tx_hash = event.transaction.hash.toHexString(); + connectorEvent.block = event.block.number; + connectorEvent.logIndex = event.logIndex; connectorEvent.save(); }