superfluid-finance / protocol-monorepo

Superfluid Protocol Monorepo: the specification, implementations, peripherals and development kits.
https://www.superfluid.finance
Other
875 stars 239 forks source link

[SUBGRAPH] fix missing token name/symbol #2017

Closed d10r closed 2 months ago

d10r commented 2 months ago

fixes #1992

d10r commented 2 months ago

what happened: Custom Super Tokens tend to register via factory before initializing themselves via SuperToken.initialize(), this is the case for the native token wrapper too (see deploy script). As a result, the first invocation of getOrInitSuperToken() queries a token proxy contract which points to the canonical SuperToken logic, but isn't yet initialized.
Initialization typically happens in another transaction closely following.

The previous code handled later updating of the token symbol, but that's not the only field set on initialize, see SuperToken._initialize().
The logic now is: if symbol and name have zero length (proxy condition for detecting an uninitialized token), sync all the entity data from RPC again. This should cover all special cases of this category, even those we don't yet see - e.g. a custom SuperToken wrapper.

github-actions[bot] commented 2 months ago

XKCD Comic Relif

Link: https://xkcd.com/2017 https://xkcd.com/2017