Skip to content

Commit

Permalink
sys-lend: skip rebalance if source and destination pools are the same
Browse files Browse the repository at this point in the history
  • Loading branch information
mvines committed May 20, 2024
1 parent 5bcb8ea commit d3bb7d6
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/bin/sys-lend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,10 +555,16 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let ops = match cmd {
Command::Deposit => vec![(Operation::Deposit, deposit_pool)],
Command::Withdraw => vec![(Operation::Withdraw, withdraw_pool)],
Command::Rebalance => vec![
(Operation::Withdraw, withdraw_pool),
(Operation::Deposit, deposit_pool),
],
Command::Rebalance => {
if withdraw_pool == deposit_pool {
println!("Nothing to rebalance");
return Ok(());
}
vec![
(Operation::Withdraw, withdraw_pool),
(Operation::Deposit, deposit_pool),
]
}
};

let mut instructions = vec![];
Expand Down

0 comments on commit d3bb7d6

Please sign in to comment.