Timestamp dependency
Unlike typical programs, the smart contract's execution environment is on the miner's side. When a contract's logic is dependent on the current time, the miner can manipulate the current time to influence the execution result and meet a predetermined goal.
Function visibility errors
A function's default visibility property in Solidity is public. As a result, anyone can access it if a developer forgets to define a private function's visibility. For example, anyone can call the Destruct function to destroy the contract immediately.
Reentrancy attacks
One of the most devastating attacks in the Solidity smart contract is the reentrancy attack. A developer's uncaring attitude can potentially lead to reentrancy issues. When a function makes an external call to another untrusted contract, it is called a reentrancy attack. Then, in an attempt to drain funds, the untrustworthy agreement makes a recursive call back to the original function.
Random number vulnerability
An attacker can accurately guess the random number generated by a contract that employs a publicly known variable as a seed.
Failure in differentiating humans and contracts
Failure to identify whether the smart contract caller is a person or a contract could have unforeseeable repercussions. For instance, by correctly guessing the block in the popular Fomo3d game, a hacker can earn money via the airdrop function (i.e., by accurately predicting a contract's timestamp).
Spelling mistakes
Constructors are commonly used for contract initialization and determining the contract's owner. The compiler would not notice the misspelling of the function during programming, resulting in the function being public so that anyone can call.
In Solidity, a function is used to set the state variables of a contract. When a contract is first constructed, the function is invoked, and it can be used to set initial values. There are two types of constructors: public and internal. Moreover, the Solidity code is compiled using a Solidity compiler, which produces byte code and other artifacts required for smart contract deployment.