diff --git a/packages/nouns-subgraph/schema.graphql b/packages/nouns-subgraph/schema.graphql index d441729b69..e2b49c00d7 100644 --- a/packages/nouns-subgraph/schema.graphql +++ b/packages/nouns-subgraph/schema.graphql @@ -5,6 +5,9 @@ type DelegationEvent @entity { "The Noun being delegated" noun: Noun! + "Current delegator address" + delegator: Account! + "Previous delegate address" previousDelegate: Delegate! diff --git a/packages/nouns-subgraph/src/nouns-erc-721.ts b/packages/nouns-subgraph/src/nouns-erc-721.ts index e383078d02..11758bc543 100644 --- a/packages/nouns-subgraph/src/nouns-erc-721.ts +++ b/packages/nouns-subgraph/src/nouns-erc-721.ts @@ -71,6 +71,7 @@ export function handleDelegateChanged(event: DelegateChanged): void { delegateChangedEvent.previousDelegate = previousDelegate.id ? previousDelegate.id : tokenHolder.id; + delegateChangedEvent.delegator = tokenHolder.id.toString(); delegateChangedEvent.newDelegate = newDelegate.id ? newDelegate.id : tokenHolder.id; delegateChangedEvent.save(); } @@ -172,6 +173,7 @@ export function handleTransfer(event: Transfer): void { delegateChangedEvent.newDelegate = toHolder.delegate ? toHolder.delegate!.toString() : toHolder.id.toString(); + delegateChangedEvent.delegator = fromHolder.id.toString(); delegateChangedEvent.save(); let toHolderDelegate = getOrCreateDelegate(toHolder.delegate ? toHolder.delegate! : toHolder.id);