feat: Update tycho-encode bin with new arguments
--- don't change below this line --- ENG-4446 Took 51 minutes Took 9 seconds
This commit is contained in:
@@ -44,11 +44,15 @@ pub struct Cli {
|
|||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
pub command: Commands,
|
pub command: Commands,
|
||||||
#[arg(short, long)]
|
#[arg(short, long)]
|
||||||
|
chain: Chain,
|
||||||
|
#[arg(short, long)]
|
||||||
executors_file_path: Option<String>,
|
executors_file_path: Option<String>,
|
||||||
#[arg(short, long)]
|
#[arg(short, long)]
|
||||||
router_address: Option<Bytes>,
|
router_address: Option<Bytes>,
|
||||||
#[arg(short, long)]
|
#[arg(short, long)]
|
||||||
swapper_pk: Option<String>,
|
swapper_pk: Option<String>,
|
||||||
|
#[arg(short, long)]
|
||||||
|
token_in_already_in_router: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Subcommand)]
|
#[derive(Subcommand)]
|
||||||
@@ -61,8 +65,6 @@ pub enum Commands {
|
|||||||
|
|
||||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let cli = Cli::parse();
|
let cli = Cli::parse();
|
||||||
let chain = Chain::Ethereum;
|
|
||||||
|
|
||||||
// Read from stdin until EOF
|
// Read from stdin until EOF
|
||||||
let mut buffer = String::new();
|
let mut buffer = String::new();
|
||||||
io::stdin()
|
io::stdin()
|
||||||
@@ -74,6 +76,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
}
|
}
|
||||||
let solution: Solution = serde_json::from_str(&buffer)?;
|
let solution: Solution = serde_json::from_str(&buffer)?;
|
||||||
|
|
||||||
|
let chain = cli.chain;
|
||||||
let encoder: Box<dyn TychoEncoder> = match cli.command {
|
let encoder: Box<dyn TychoEncoder> = match cli.command {
|
||||||
Commands::TychoRouter => {
|
Commands::TychoRouter => {
|
||||||
let mut builder = TychoRouterEncoderBuilder::new().chain(chain);
|
let mut builder = TychoRouterEncoderBuilder::new().chain(chain);
|
||||||
@@ -86,6 +89,9 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
if let Some(swapper_pk) = cli.swapper_pk {
|
if let Some(swapper_pk) = cli.swapper_pk {
|
||||||
builder = builder.swapper_pk(swapper_pk);
|
builder = builder.swapper_pk(swapper_pk);
|
||||||
}
|
}
|
||||||
|
if let Some(token_in_already_in_router) = cli.token_in_already_in_router {
|
||||||
|
builder = builder.token_in_already_in_router(token_in_already_in_router);
|
||||||
|
}
|
||||||
builder.build()?
|
builder.build()?
|
||||||
}
|
}
|
||||||
Commands::TychoExecutor => TychoExecutorEncoderBuilder::new()
|
Commands::TychoExecutor => TychoExecutorEncoderBuilder::new()
|
||||||
|
|||||||
Reference in New Issue
Block a user