Close, there are two cases to consider:
-
The first query where nothing is in the database. In this case, we fetch the ACS from the ledger, we store it in the database and we record the offset of that ACS.
-
On following queries, we then fetch the offset from the database, query the transaction stream between this offset and current ledger end and use that to add or remove contracts based on
Create
andArchive
events.