Giter Club home page Giter Club logo

benrockiee / car-race- Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 247 KB

This is a Car Race contract where racers can participate by initially depositing some amount of Ether to be able to enter race. This contract uses Chainlink keepers to automate and trigger the verifiably random winner of the race, we also get the random blown tyre or faulty engine during this race contest as well as ensuring a totally decentralized competition and verified on Etherscan Block explorer.

Solidity 25.81% JavaScript 74.19%

car-race-'s Introduction

Car Race Project

This project demonstrates a car race competition, using the chainlink oracles to determine and automate our verifiably random winner. It comes with a complex contract, tests (staging and unit tests) for this contract, the mock deployment (development chains) and the rinkeby deployment (testnet) for this contract.

car-race-'s People

Contributors

benrockiee avatar

Watchers

 avatar

car-race-'s Issues

Optimize Smart Contract

I've reviewed your smart contract and found a few areas for optimization.

  • The variable s_recentBlownTyre should be marked as constant to improve code readability and ensure its value cannot be changed.
  • The variable Race.s_recentBlownTyre was found to be unused in the contract. Consider removing it to reduce code complexity and improve performance.
  • I recommend following naming conventions for variables as outlined in the Solidity style guide, found here: https://docs.soliditylang.org/en/v0.4.25/style-guide.html#local-and-state-variable-names.

Contract Vulnerability - Reentrancy Attack

I've identified a potential security vulnerability in the contract related to reentrancy attacks. Upon further investigation, I've found that the fulfillRandomWords and performUpkeep functions are both vulnerable to reentrancy attacks.

To mitigate this risk, I suggest adding the ReentrancyGuard from the Openzeppelin library to both the fulfillRandomWords and performUpkeep functions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.