Virgil
Virgil
`sell` passes the absolute value of the hub asset imbalance to `calculate_sell_state_changes`, ignoring the sign: https://github.com/galacticcouncil/HydraDX-node/blob/8de6222f967cc1bfe120207a775e8f0dc8eb92a5/pallets/omnipool/src/lib.rs#L957 . This should be safe, since the LRNA imbalance is always negative for now....
`calculate_delta_imbalance` uses `asset_state.reserve` and `asset_state.hub_reserve` for its computation: https://github.com/galacticcouncil/HydraDX-math/blob/f4dab244bb5d57971325f0ba6fbb8f6c1353beeb/src/omnipool/math.rs#L419-L421 `add_liquidity` calls `recalculate_imbalance` which calls `calculate_delta_imbalance` with `new_asset_state` as an argument. This means that `calculate_delta_imbalance` receives the updated values for `asset_state.reserve`...
The sell endpoint does not check that the in and out assets are distinct. At the same time, it loads the asset data for both assets near the start of...
The `SimpleBalance` implementation does not use a consistent sign for `0`. By default `0` is negative, and `add` also makes `0` negative, but `sub` makes it positive. In the current...