-
Notifications
You must be signed in to change notification settings - Fork 0
integrate SDK into engine #15
Description
SDK is designed for application-agnotic: it can serve dex front-end, wallet, cex, and other tools
Engine is designed for dapp.
Engine stores multiple pools, accounts for multiple chains.
Engine loads state data from rpc.
Engine loads logs from both rpc and etherscan (via AsssistedJsonRpc)
Engine keeps track of states (pools, accounts) TTL to automatically refesh outdated data.
Engine maintains and uses user configs (see app.derion.io FE)
Engine keeps track of canonical state and logs to handle chain data and logs re-org.
For each log processed, the highest blockNumber and logIndex processed are consider logHead. For each chain id, a CANON_DEPTH is defined, and every logs with blockNumber > chainHead - CANON_DEPTH are considered non-canon. Non-canon logs are still used to calculate the state of the engine, but are not persisted in the storage (in a immutable way).
Tx reciepts' logs are also trasient logs that engine can accepted without a blockNumber. This is useful in case of tx sent by users by out dapp can have the position displayed before the tx is confirmed in a block (or the etherscan indexer is laggrd behind in data)
New features are always updated for both SDK and Engine. SDK are stateless, and Engine keep the state for the FE.