Last updated block number for tp and sl are incorrect when trade is registered
The function registerTrade
calls storageT.storeTrade
to store the final trade in the storage contract. This function also updates the TP and SL values, which means that these values are updated in the current block. The storeTrade
function is called as follows:
storageT.storeTrade(
trade,
IOstiumTradingStorage.TradeInfo(
trade.collateral * uint256(1e12)
* trade.leverage / 100 * PRECISION_18 / trade.openPrice,
trade.leverage,
0,
0,
false
)
);
As shown above, the value of tpLastUpdated
and slLastUpdated
are set to 0
in the TradeInfo
struct, but these values should be set to the current block number. We suggest updating the function call to set the tpLastUpdated
and slLastUpdated
values as the current block number.
This issue has been acknowledged by Ostium Labs, and a fix was implemented in commit 9b977c93↗.