Skip to content

Commit

Permalink
fix: correctly overwrites balances
Browse files Browse the repository at this point in the history
We were overwriting balances only for sell and buy tokens. But some SwapAdapter rely on every balances of the pool being there which might not be the case if the pool has 2+ tokens.
  • Loading branch information
zizou0x committed Dec 10, 2024
1 parent 28d3ad3 commit b5b7f2d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/evm/protocol/vm/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,13 @@ where
tokens: Vec<Address>,
max_amount: U256,
) -> Result<HashMap<Address, Overwrites>, SimulationError> {
let sell_token = &tokens[0].clone();
let sell_token = &tokens[0].clone(); //TODO: need to make it clearer from the interface
let mut res: Vec<HashMap<Address, Overwrites>> = Vec::new();
if !self
.capabilities
.contains(&Capability::TokenBalanceIndependent)
{
res.push(self.get_balance_overwrites(tokens)?);
res.push(self.get_balance_overwrites(self.tokens.clone())?);
}

let (slots, compiler) = self
Expand Down

0 comments on commit b5b7f2d

Please sign in to comment.