feat(factory): add StablecoinCreated and SecurityCreated companion events#85
Open
eric-ships wants to merge 1 commit into
Open
feat(factory): add StablecoinCreated and SecurityCreated companion events#85eric-ships wants to merge 1 commit into
eric-ships wants to merge 1 commit into
Conversation
…ents (BOP-158) Adds two variant-specific events emitted immediately after B20Created in the same transaction. Stream-based indexers (e.g. Coindexer) that cannot make mid-handler view calls can subscribe to these events to populate variant-specific columns without hitting archival nodes. StablecoinCreated(address indexed token, string currency) — carries the immutable currency field (e.g. "USD") that has no setter post-creation and was previously unobservable from the event stream. SecurityCreated(address indexed token, string isin) — carries the primary ISIN identifier set at creation. Additional identifiers (CUSIP, FIGI, SEDOL) remain attachable post-creation via updateSecurityIdentifier. B20Created is unchanged; these events are additive companions only.
| /// @param token The address of the newly created security token. | ||
| /// Matches the `token` field on the preceding `B20Created`. | ||
| /// @param isin The ISIN identifier written at creation (e.g. `"US0378331005"`). | ||
| event SecurityCreated(address indexed token, string isin); |
Collaborator
There was a problem hiding this comment.
I don't see why we need this event. We already emit when security identifiers are updated on the token
| /// Matches the `token` field on the preceding `B20Created`. | ||
| /// @param currency The ISO 4217 currency identifier (e.g. `"USD"`, `"EUR"`). | ||
| /// Uppercase ASCII letters (`A`–`Z`); immutable after creation. | ||
| event StablecoinCreated(address indexed token, string currency); |
Collaborator
There was a problem hiding this comment.
Feels crufty. We only think we want this event in the factory because we don't have it on the token. We don't have it on the token because the currency is immutable. Adding a second event on the factory just for this field feels off. Would be curious to get your take on generalizing (of which I see a couple options, but none feel great either).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BOP-158
Motivation
Stablecoin
currencyand securityisinare immutable post-creation with no setters, so they were unobservable from the event stream. Stream-based indexers (e.g. Coindexer) that cannot make mid-handler RPC calls had no way to index them.What changed
Two new events emitted immediately after
B20Createdin the same transaction:StablecoinCreated(address indexed token, string currency)SecurityCreated(address indexed token, string isin)B20Createdis unchanged. 10 new tests verify field values, ordering, and cross-variant isolation.type=standard
risk=low
impact=sev5