Sync Meeting, 23/03/2023
===
###### tags: `Sync`
:::info
**Agenda**
1. Quick status update
2. Discuss any topics and blockers
3. Revisit tasks
- **Last week sync:** [https://hackmd.io/ijeZ1-1GReunYJUQ5FeSBg](https://hackmd.io/ijeZ1-1GReunYJUQ5FeSBg)
:::
## :dart: Status update
#### Add below your status update
- Aiden Huffman: UniswapV3 has a prototype implementation. Math for StablePools, WeightedPools and LinearPools is implemented (Curve, Balancer).
## :books: Topics to discuss
#### Add below topics to discuss
1. **Fork handling/parsing**
- We have univ2, v3 and soon balancer. Enso has some data already on forks of projects, and George added an example for [sushiswap](https://github.com/EnsoFinance/amm-indexer/commit/a5fc9774844966804a5ef31a7cf3a6b554609a5d). So we should create a task on who would integrate Enso data on this, and also add the factory addresses for all the forks.
2. **Liquidity filtering**
- It was previously discussed to remove pools that have below $X threshold to remove our data overhead. However, this will remove our routes being able to interact with verbose new tokens, and could remove potential "edge" of charging higher fees as we're the only provider for this, and degen users loosing potential volume.
- Discussion result:
- Need to test the pathfinding algo to see what we would be missing.
3. **Memgraph**
- Added support for Memgraph to the seeder, which in our testing has resulted in approximately a 2x speedup vs Neo4j for seeding.
- Both Neo4j and Memgraph running on latest versions in separate Docker containers.
- Total times to seed between (Memgraph: 250s vs Neo4j: 500s) to (Memgraph: 350s vs Neo4j: 700s) depending on hardware.
- Existing NodeJS driver works with Memgraph with only minor tweaks to queries.
- Rust driver does not work with the free version of Memgraph due to always requesting a specific database when running queries. May work with Memgraph Enterprise, which supports multiple databases.
- Currently working on adding Memgraph support to the indexer via the [rsmgclient](https://docs.rs/rsmgclient/2.0.1/rsmgclient/index.html) crate.
## :x: Blockers
#### Add below blockers to discuss
1. Neo4j isn't properly filtering the projection based on implemented protocols, working with their support. Call below allows us to limit calls to protocols we've implemented in the optimizer, but graph projection retains UniswapV3 edges.
```
MATCH (a:Token)-[e:Action]->(b:Token)
WHERE e.weight IS NOT NULL AND e.protocol IN ['UniswapV2']
WITH gds.graph.project(
'filteredGraph',
a, b,
{relationshipProperties: 'weight'}) AS g
RETURN g.graphName
```
2. Running the following query, should filter out edges from the graph data science projection that aren't UniswapV2.
```
MATCH (a:Token)-[e:Action]->(b:Token)
WHERE e.weight IS NOT NULL AND e.protocol IN ['UniswapV2']
WITH gds.graph.project(
'filteredGraph',
a, b,
{relationshipProperties: 'weight'}) AS g
RETURN g.graphName
```
This is essential long term, because we need to be able to isolate edges or remove edges from protocols we are testing developing.
3. Python package for Neo4j doesn't seem to scrape the same data as the Neo4j desktop app. Data pulled by Python doesn't contain segment information. The records.json is pulled from the desktop app and includes "segments". This tells us which edge we took, rather than just which nodes we travelled too. This is necessary to determine the actual path with more than one protocol. See Slack discussion [here](https://162digitalcapital.slack.com/archives/C05HB9Y8ZFW/p1692797006560319)
## :closed_book: Tasks (sorted by priority in Linear)
### Completed
- [Route api params](https://github.com/EnsoFinance/amm-indexer/pull/22)
- [Migrate previous Enso positions](https://github.com/EnsoFinance/amm-indexer/pull/20)
- [liquidity filter $15k](https://github.com/EnsoFinance/amm-indexer/commit/5b656a9c337cf98dcb4e327eec7b04d224619bb6)
- [Prototype UniswapV3 calculations implemented](https://github.com/chrischung288/-routeOptimization-py/issues/1)
#### In Progress
- [PAT-1 : Investigate MemgraphDB as drop-in replacement for Enso pathfinding](https://linear.app/enso/issue/PAT-1)
- [PAT-7 : Add Balancer to Indexer](https://linear.app/enso/issue/PAT-7) which can be viewed on [github](https://github.com/EnsoFinance/amms-rs/tree/grw/adds-balancer-stable)
- [PAT-5 : Prototype implementation for UniswapV3](https://linear.app/enso/issue/PAT-5)
- [PAT-6 : Prototype implementation for StablePool/WeightedPool/LinearPool](https://linear.app/enso/issue/PAT-6)
#### To Do
- [PAT-2 : Setup Production Memory Graph Database to replace Neo4j](https://linear.app/enso/issue/PAT-2)
- [PAT-11 : Return actions from indexer](https://linear.app/enso/issue/PAT-11)
- [PAT-10 : Action composer](https://linear.app/enso/issue/PAT-10)
- [PAT-9 : Add Curve to Indexer](https://linear.app/enso/issue/PAT-9)
- [PAT-8 : Custom path-finding algorithm](https://linear.app/enso/issue/PAT-8)
- [PAT-4 : Setup Historical Block by Block Transactional Data](https://linear.app/enso/issue/PAT-4)
- [PAT-3 : Setup Historical Block by Block Graph DB](https://linear.app/enso/issue/PAT-3)
## :heavy_plus_sign: Takeaways and action points
- Add Aiden's pricing calculations (https://linear.app/enso/issue/PAT-12)
- Log weights/positive weights added properly to test (https://linear.app/enso/issue/PAT-13)
- Add k-shortest-path into the indexer (https://linear.app/enso/issue/PAT-14)
- Finalize balancer integration (https://linear.app/enso/issue/PAT-7)
- Return actions in particular data format (https://linear.app/enso/issue/PAT-11)
- Add forks inside of the indexer repo (https://linear.app/enso/issue/PAT-19)
- Add Curve (https://linear.app/enso/issue/PAT-9)
- Add Solidly (https://linear.app/enso/issue/PAT-15)
- Add Quickswap (https://linear.app/enso/issue/PAT-17)
- Balancer protocol pools tokens for accounting and executes logic over top (https://linear.app/enso/issue/PAT-22)
- This improves gas efficiency and is something we should take advantage of long term.
- Add balancer gas discounts being a solver (https://linear.app/enso/issue/PAT-20)
- Finalize testing of memgraph and determine if it can be used or a petGraph implemention inside the Indexer would be required instead (https://linear.app/enso/issue/PAT-1)
- Adjust data for routes that currently do not have pricing functions inside the indexer (https://linear.app/enso/issue/PAT-21)
- Compare performance of our routes versus competition (https://linear.app/enso/issue/PAT-18)