  We propose a construction of some canonical bases for quantum loop algebras
of Kac-Moody algebras. We consider a smooth projective curve X, a group of
automorphism G of X such that X/G=P^1, and we consider some Quot schemes of
G-equivariant coherent sheaves on X. We view these spaces as loop analogues of
spaces of representations of quivers and following Lusztig, we consider a
convolution algebra of (semisimple, equivariant) perverse sheaves on the
collection of these Quot schemes. We relate this algebra to a quantum loop
algebra of some Kac-Moody algebra. In particular, when X=P^1 and G is a
subgroup of SL(2,C), we obtain a canonical basis of a positive part of a
quantum affine algebra in the Drinfeld presentation, and relate it (in some
examples) to the bases constructed by Lusztig and Kashiwara. When X is an
elliptic curve, we will obtain in this way a canonical basis of quantum
toroidal algebras of type D_4, E_6, E_7 and E_8.
