diff --git a/packages/subgraph/schema.graphql b/packages/subgraph/schema.graphql index dc662fbc35..d66a1060da 100644 --- a/packages/subgraph/schema.graphql +++ b/packages/subgraph/schema.graphql @@ -2272,6 +2272,7 @@ type Token @entity { underlyingToken: Token """ + If `governanceConfig.id` is the zero address, the token uses the default governance config. """ governanceConfig: TokenGovernanceConfig } diff --git a/packages/subgraph/src/mappingHelpers.ts b/packages/subgraph/src/mappingHelpers.ts index 2d14d64e98..67b97e7b11 100644 --- a/packages/subgraph/src/mappingHelpers.ts +++ b/packages/subgraph/src/mappingHelpers.ts @@ -121,6 +121,7 @@ export function getOrInitSuperToken( token.isListed = false; const underlyingAddress = token.underlyingAddress; token.underlyingToken = underlyingAddress.toHexString(); + token.governanceConfig = ZERO_ADDRESS.toHexString(); token.save(); @@ -203,6 +204,12 @@ export function getOrInitTokenGovernanceConfig( governanceConfig.token = superTokenAddress.toHexString(); governanceConfig.save(); + + const superToken = Token.load(superTokenAddress.toHexString()); + if (superToken) { + superToken.governanceConfig = governanceConfig.id; + superToken.save(); + } } return governanceConfig; }