Smart contracts, one of the success stories in blockchain 2.0, have been widely utilized in a broad range of applications, including those involving Internet of Things (IoT). Given the fast-pace nature of the topic, it can be challenging for the research community to keep track of the latest advances. Hence, in this article, we perform a comprehensive, in-depth review of known security challenges (e.g., inherently vulnerable particularities, programming vulnerabilities, and attacks) and potential research opportunities associated with the deploying of smart contracts in an IoT setting. We hope this survey will serve as a starting point for the readers seeking to understand and explore the potential applications of smart contracts.