Dear Gholamreza: your question should be more specific. Which metallic deposits are you talking about? Cr, Ni, PGE; or Cu-Pb-Zn-Au-Ag, or Sn-Nb-Ta, or Li-Be, or Hg-As, etc.? In general volcanic and metavolcanic rocks, tuffs and/or lavas, are progidal in volcanogenic massive sulfides, rich in Cu-Pb-Zn ores, and epithermal Au-Ag-Se-Te deposits; large stratiform gabbroic intrusions abound in magmaticm seggregation deposits, such as chromitites or PGE-reefs; most leucogranites have usually associated skarns, greisen or pegmatites riddled with rare elements, such as Li, Be, Nb, Ta, U, Sn, W and so on; carbonatites are a great source of REE, Nb, Sr and Ba. As you can see your question covers vast topics, it is like a whole course in metallic ore deposits. Regards. Sebastian.
In those rocks where a pathway from a source rock to the host rock occurs and on the way trapping physical-chemical conditions become more and more favorable in space and time for the elements in question .