A Survey of Security Vulnerabilities and Detection Methods for Smart Contracts