feat(tycho-router-encoder): Select strategy depending on the solution

- The tycho router address default is set at the EncoderBuilder level (not inside the strategies)
- Rename TychoCoreChain to TychoCommonChain
- Only take TychoCommonChain as an argument at the outermost level: EncoderBuilder. Everywhere else we use the execution Chain right away

--- don't change below this line ---
ENG-4332 Took 1 hour 10 minutes
This commit is contained in:
Diana Carvalho
2025-04-08 15:55:55 +01:00
parent 6fd0ab54c1
commit f5e712e0ff
6 changed files with 150 additions and 147 deletions

View File

@@ -2,7 +2,7 @@ use hex;
use num_bigint::BigUint;
use serde::{Deserialize, Serialize};
use tycho_common::{
models::{protocol::ProtocolComponent, Chain as TychoCoreChain},
models::{protocol::ProtocolComponent, Chain as TychoCommonChain},
Bytes,
};
@@ -121,15 +121,15 @@ pub struct Chain {
pub name: String,
}
impl From<TychoCoreChain> for Chain {
fn from(chain: TychoCoreChain) -> Self {
impl From<TychoCommonChain> for Chain {
fn from(chain: TychoCommonChain) -> Self {
match chain {
TychoCoreChain::Ethereum => Chain { id: 1, name: chain.to_string() },
TychoCoreChain::ZkSync => Chain { id: 324, name: chain.to_string() },
TychoCoreChain::Arbitrum => Chain { id: 42161, name: chain.to_string() },
TychoCoreChain::Starknet => Chain { id: 0, name: chain.to_string() },
TychoCoreChain::Base => Chain { id: 8453, name: chain.to_string() },
TychoCoreChain::Unichain => Chain { id: 130, name: chain.to_string() },
TychoCommonChain::Ethereum => Chain { id: 1, name: chain.to_string() },
TychoCommonChain::ZkSync => Chain { id: 324, name: chain.to_string() },
TychoCommonChain::Arbitrum => Chain { id: 42161, name: chain.to_string() },
TychoCommonChain::Starknet => Chain { id: 0, name: chain.to_string() },
TychoCommonChain::Base => Chain { id: 8453, name: chain.to_string() },
TychoCommonChain::Unichain => Chain { id: 130, name: chain.to_string() },
}
}
}