Skip to content
This repository has been archived by the owner on Aug 10, 2023. It is now read-only.

closes #40 #42

Merged
merged 1 commit into from
Aug 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions bot/crates/strategy/src/bot/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ impl<M: Middleware + 'static> SandoBot<M> {

/// Main logic for the strategy
/// Checks if the passed `RawIngredients` is sandwichable
#[allow(unused_mut)]
pub async fn is_sandwichable(
&self,
ingredients: RawIngredients,
Expand All @@ -67,13 +66,12 @@ impl<M: Middleware + 'static> SandoBot<M> {
Some((target_block.number - 1).into()),
);

let mut weth_inventory = self.sando_state_manager.get_weth_inventory();

#[cfg(feature = "debug")]
{
// Set a new value only when the debug feature is active
weth_inventory = (*crate::constants::WETH_FUND_AMT).into();
}
let weth_inventory = if cfg!(feature = "debug") {
// spoof weth balance when the debug feature is active
(*crate::constants::WETH_FUND_AMT).into()
} else {
self.sando_state_manager.get_weth_inventory()
};

let optimal_input = find_optimal_input(
&ingredients,
Expand Down Expand Up @@ -138,6 +136,7 @@ impl<M: Middleware + 'static> SandoBot<M> {
}

/// Process new txs as they come in
#[allow(unused_mut)]
async fn process_new_tx(&mut self, victim_tx: Transaction) -> Option<Action> {
// setup variables for processing tx
let next_block = self.block_manager.get_next_block();
Expand Down