feat: Remove router_address from TychoEncoder
Make the router address mandatory for the Solution attribute instead --- don't change below this line --- ENG-4088 Took 30 minutes
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
pub use clap::Parser;
|
||||
pub const DEFAULT_ROUTER_ADDRESS: &str = "0xaa820C29648D5EA543d712cC928377Bd7206a0E7";
|
||||
|
||||
#[derive(Parser)]
|
||||
/// Encode swap transactions for the Tycho router
|
||||
@@ -35,10 +34,6 @@ pub const DEFAULT_ROUTER_ADDRESS: &str = "0xaa820C29648D5EA543d712cC928377Bd7206
|
||||
/// }
|
||||
/// ```
|
||||
pub struct Cli {
|
||||
/// Router contract address to use for encoding transactions
|
||||
#[arg(default_value = DEFAULT_ROUTER_ADDRESS)]
|
||||
pub router_address: String,
|
||||
|
||||
/// Private key for signing approvals (required when direct_execution is false)
|
||||
#[arg(short)]
|
||||
pub private_key: Option<String>,
|
||||
|
||||
@@ -33,7 +33,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
}
|
||||
|
||||
// Encode the solution
|
||||
let encoded = encode_swaps(&buffer, &cli.router_address, cli.config_path, cli.private_key)?;
|
||||
let encoded = encode_swaps(&buffer, cli.config_path, cli.private_key)?;
|
||||
|
||||
// Output the encoded result as JSON to stdout
|
||||
println!(
|
||||
@@ -47,7 +47,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
fn encode_swaps(
|
||||
input: &str,
|
||||
router_address: &str,
|
||||
config_path: Option<String>,
|
||||
private_key: Option<String>,
|
||||
) -> Result<Value, Box<dyn std::error::Error>> {
|
||||
@@ -55,7 +54,7 @@ fn encode_swaps(
|
||||
let chain = Chain::Ethereum;
|
||||
|
||||
let strategy_selector = EVMStrategyEncoderRegistry::new(chain, config_path, private_key)?;
|
||||
let encoder = EVMTychoEncoder::new(strategy_selector, router_address.to_string(), chain)?;
|
||||
let encoder = EVMTychoEncoder::new(strategy_selector, chain)?;
|
||||
let transactions = encoder.encode_router_calldata(vec![solution])?;
|
||||
|
||||
Ok(serde_json::json!({
|
||||
|
||||
Reference in New Issue
Block a user