updateLeverage
UpdateLeverageLifecycles
This is an external library for leverage update lifecycles Used by GNSTrading and GNSTradingCallbacks facets
Initiate update leverage order, done in 2 steps because need to cancel if liquidation price reached
Execute update leverage callback
Returns current address as multi-collateral diamond interface to call other facets functions.
Returns new trade collateral amount based on new leverage (collateral precision)
Fetches trade, does validation for update leverage request, and returns useful data
Stores pending update leverage order and makes price aggregator request
Calculates values for callback
Validates callback, and returns corresponding cancel reason
Handles trade update, removes gov fee OI, and transfers collateral delta (for both successful and failed requests)
