This is handled when creating a new TychoEncoder --- don't change below this line --- ENG-4246 Took 4 minutes
57 lines
1.5 KiB
Rust
57 lines
1.5 KiB
Rust
pub use clap::Parser;
|
|
use clap::Subcommand;
|
|
|
|
#[derive(Parser)]
|
|
/// Encode swap transactions for the Tycho router
|
|
///
|
|
/// Reads a JSON object from stdin with the following structure:
|
|
/// ```json
|
|
/// {
|
|
/// "sender": "0x...",
|
|
/// "receiver": "0x...",
|
|
/// "given_token": "0x...",
|
|
/// "given_amount": "123...",
|
|
/// "checked_token": "0x...",
|
|
/// "exact_out": false,
|
|
/// "slippage": 0.01,
|
|
/// "expected_amount": "123...",
|
|
/// "checked_amount": "123...",
|
|
/// "swaps": [{
|
|
/// "component": {
|
|
/// "id": "...",
|
|
/// "protocol_system": "...",
|
|
/// "protocol_type_name": "...",
|
|
/// "chain": "ethereum",
|
|
/// "tokens": ["0x..."],
|
|
/// "contract_ids": ["0x..."],
|
|
/// "static_attributes": {"key": "0x..."}
|
|
/// },
|
|
/// "token_in": "0x...",
|
|
/// "token_out": "0x...",
|
|
/// "split": 0.0
|
|
/// }],
|
|
/// "router_address": "0x..."
|
|
/// }
|
|
/// ```
|
|
#[command(author, version, about, long_about = None)]
|
|
pub struct Cli {
|
|
#[command(subcommand)]
|
|
pub command: Commands,
|
|
}
|
|
|
|
#[derive(Subcommand)]
|
|
pub enum Commands {
|
|
/// Use the Tycho router encoding strategy
|
|
TychoRouter {
|
|
#[arg(short, long)]
|
|
config_path: Option<String>,
|
|
#[arg(short, long)]
|
|
private_key: String,
|
|
},
|
|
/// Use the direct execution encoding strategy
|
|
DirectExecution {
|
|
#[arg(short, long)]
|
|
config_path: Option<String>,
|
|
},
|
|
}
|