Skip to content

Commit

Permalink
fix incorrect entity id mapping when contract was called from another…
Browse files Browse the repository at this point in the history
… contract
  • Loading branch information
yuetloo committed May 22, 2024
1 parent f9d90ab commit dd028f9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
2 changes: 1 addition & 1 deletion subgraph/src/ClrFundDeployerMapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ClrFundDeployer, ClrFund } from '../generated/schema'
import { ClrFund as ClrFundTemplate } from '../generated/templates'

export function handleNewInstance(event: NewInstance): void {
let clrfundDeployerAddress = event.transaction.to!
let clrfundDeployerAddress = event.address
let clrfundDeployerId = clrfundDeployerAddress.toHex()

let clrFundDeployer = ClrFundDeployer.load(clrfundDeployerId)
Expand Down
2 changes: 1 addition & 1 deletion subgraph/src/MACIMapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { makePublicKeyId } from './PublicKey'
// - contract.verifier(...)

export function handleSignUp(event: SignUp): void {
let fundingRoundAddress = event.transaction.to!
let fundingRoundAddress = event.address
let fundingRoundId = fundingRoundAddress.toHex()

let publicKeyId = makePublicKeyId(
Expand Down
12 changes: 2 additions & 10 deletions subgraph/src/PollMapping.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
import { log } from '@graphprotocol/graph-ts'
import { PublishMessage } from '../generated/templates/Poll/Poll'

import { FundingRound, Poll, Message, PublicKey } from '../generated/schema'
import { Poll, Message, PublicKey } from '../generated/schema'
import { makePublicKeyId } from './PublicKey'

export function handlePublishMessage(event: PublishMessage): void {
if (!event.transaction.to) {
log.error(
'Error: handlePublishMessage failed fundingRound not registered',
[]
)
return
}

let pollEntityId = event.transaction.to!.toHex()
let pollEntityId = event.address.toHex()
let poll = Poll.load(pollEntityId)
if (poll == null) {
log.error('Error: handlePublishMessage failed poll not found {}', [
Expand Down

0 comments on commit dd028f9

Please sign in to comment.