Don't make selector() a member of the StrategyEncoder trait. It is needed only for certain strategies. The strategy should manage it itself. --- don't change below this line --- ENG-4081 Took 17 minutes
23 lines
538 B
Rust
23 lines
538 B
Rust
use tycho_core::{models::Chain, Bytes};
|
|
|
|
use crate::encoding::{errors::EncodingError, models::Solution};
|
|
|
|
#[allow(dead_code)]
|
|
pub trait StrategyEncoder {
|
|
fn encode_strategy(
|
|
&self,
|
|
to_encode: Solution,
|
|
router_address: Bytes,
|
|
) -> Result<Vec<u8>, EncodingError>;
|
|
}
|
|
|
|
pub trait StrategySelector {
|
|
#[allow(dead_code)]
|
|
fn select_strategy(
|
|
&self,
|
|
solution: &Solution,
|
|
signer_pk: Option<String>,
|
|
chain_id: Chain,
|
|
) -> Result<Box<dyn StrategyEncoder>, EncodingError>;
|
|
}
|