Thermodynamically based diffuse-interface methods are promising methods for direct pore-scale numerical simulations of multiphase multicomponent flows. The Cahn-Hilliard equations for a two-component flow are obtained after minimization of the total Helmholtz free energy. In this talk, we present a discontinuous Galerkin discretization of the coupled Cahn-Hilliard equations with the Navier-Stokes equations. Wettability on rock-fluid interfaces is accounted for via an energy-penalty based wetting (contact-angle) boundary condition. The method is numerically verified by obtaining optimal convergence rates. Several physical validation tests show the robustness and accuracy of the proposed algorithm.