Direct trading is a promising approach to simultaneously achieve trading benefits and reduce transmission line losses in smart grid. However, due to the selfish nature, small-scale electricity suppliers (SESs) and electricity consumers (ECs) will not participate direct trading if the trading does not bring them benefits. Therefore, how to provide proper economic incentives for these two parties to take part in direct trading is an essential issue. Nevertheless, the asymmetry trading information between them makes the problem challenging. In this paper, we propose a contract-based direct trading framework to tackle this challenge, in which the decision making process of ECs and SESs in the presence of asymmetric information is modeled as a contract game. In the proposed game, the EC designs a contract which contains its trading strategies toward all types of SESs. Through the contract, the EC not only attracts SESs to sell electricity but also maximizes its own revenue. The SESs, on the other hand, get maximal benefits if they truthfully select the contract items of their own types. We derive theoretically the optimal contract for the short-term market where the supply of SESs is deterministic. Then we extend our study to the long-term market where the supply of SESs is encountering significant uncertainty. Finally, simulation results are shown to verify the effectiveness of the proposed scheme.