When a user buys on market and it doesn't have enough ETH wrapped, the computation of the needed amount is assuming a 1 price.
To fix this, we need to know how the purchase is going to be executed (which orders will be filled). We already have this information in startBuySellMarketSteps, since we use this to check if the entered amount can be bought. The quick fix here is to use that information to compute the effective price (weighted average of the prices of the orders that will be filled) and pass that down to createBuySellMarketSteps.
When a user buys on market and it doesn't have enough ETH wrapped, the computation of the needed amount is assuming a 1 price.
To fix this, we need to know how the purchase is going to be executed (which orders will be filled). We already have this information in
startBuySellMarketSteps
, since we use this to check if the entered amount can be bought. The quick fix here is to use that information to compute the effective price (weighted average of the prices of the orders that will be filled) and pass that down tocreateBuySellMarketSteps
.