Skip to content
Request an audit

‹ All findings

Oracle fees should be payed upfront to protect the protocol from failed performeUpkeep() calls

Crit/HighOstium·Three Sigma · RWA perpetuals DEX · 19th February, 20243S-OS-M05

Description

At the moment oracle fees are payed after the trades have been finalized, either in registerTrade(), openTradeMarketCallback() or closeTradeMarketCallback().

There are some edge cases in which the trade does not get finalized, but the automation/upkeep is still performed, so the protocol incurs these losses.

For example, if there is not a trade in openTradeMarketCallback(), fees will not be charged (this may happen if the user cancels the pending market open order after the timeout, but chainlink triggers the upkeep after closing).

Recommendation

Make the user pay oracle fees when they open the trades.

Status

Acknowledged