In principle, you can sign an independent contractor agreement with EU Company, except if you are a part of persons listed in Regulation No 359/2011. Art.2 para.2 this regulation prohibits the availability of funds and economic resources from these listed persons. Also, regulation 267/2012 in its Art.4 prohibits purchase, import, or transport from Iran the goods and technology listed in Annex I or II whether the item concerned originates in Iran. So, if you are not included in these lists, you can sign a contract with an EU company to work remotely. It must be considered that payments to an Iranian bank account are restricted due to FATF provisions that limit such transactions. In this case, you may face some issues except if you provide a non-Iranian bank account to get paid for your work subject to the EU company consent.