Added metadata to connector events, dsa events and casts

This commit is contained in:
Juan Manuel Rodriguez Defago 2020-06-10 12:17:49 -03:00
parent 6498fb0512
commit 1afc9c7de6
4 changed files with 66 additions and 1 deletions

View File

@ -171,5 +171,11 @@ type ConnectorEvent @entity {
eventCode: Bytes!
eventData: Bytes!
tx_hash: String!
block: BigInt!
logIndex: BigInt!
}
```

View File

@ -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!
}

View File

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

View File

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