feat(curve): add coins in static attributes (#205)

* feat(curve): add coins in static attributes

This will be used by tycho-execution when executing swaps on the pool. It is needed because the `exchange` function takes token indexes and not addresses as input.

* style: make clippy happy with `format!`

---------

Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
This commit is contained in:
Zizou
2025-05-13 18:57:06 +02:00
committed by GitHub
parent 2a77cf965c
commit 62b178ad8f
6 changed files with 78 additions and 23 deletions

View File

@@ -4,7 +4,7 @@ use std::{collections::HashMap, iter::zip};
use substreams_ethereum::pb::eth::v2::TransactionTrace;
use tycho_substreams::prelude::*;
const PARAMS_SEPERATOR: &str = ",";
const PARAMS_SEPERATOR: &str = "#";
#[derive(Debug, Deserialize, PartialEq)]
struct PoolQueryParams {
@@ -127,7 +127,7 @@ fn parse_params(params: &str) -> Result<HashMap<String, PoolQueryParams>, anyhow
.split(PARAMS_SEPERATOR)
.map(|param| {
let pool: PoolQueryParams = serde_qs::from_str(param)
.with_context(|| format!("Failed to parse pool query params: {0}", param))?;
.with_context(|| format!("Failed to parse pool query params: {param}"))?;
Ok((pool.tx_hash.clone(), pool))
})
.collect::<Result<HashMap<_, _>>>()