fn margin_mode_for_settlement( ctx: &EngineCtx, wallet: WalletAddress, ) -> Result<MarginMode, String>