Note
This demo represents an educational example to use a Chainlink system, product, or service and is provided to demonstrate how to interact with Chainlink’s systems, products, and services to integrate them into your own. This template is provided “AS IS” and “AS AVAILABLE” without warranties of any kind, it has not been audited, and it may be missing key checks or error handling to make the usage of the system, product or service more clear. Do not use the code in this example in a production environment without completing your own audits and application of best practices. Neither Chainlink Labs, the Chainlink Foundation, nor Chainlink node operators are responsible for unintended outputs that are generated due to errors in code.
This project has been developed for educational purposes only and is not meant to be used for gambling.
This project demostrates how to build a smart contract based application using real time sports data via Chainlink Functions.
Additionally, the project showcases how to send automatic payouts using Chainlink Automation and how to transfer tokens cross-chain using Chainlink CCIP.
- Node.js version 18 or higher
Clone the repo:
git clone https://github.com/smartcontractkit/prediction-game
It contains two separate projects:
Navigate to each directory and follow the instructions in their respective README files, starting with the contracts.
Code references:
- Predict game result: PredictionGame.sol#L116
- Check for finished games: PredictionGame.sol#379
- Request game result: ResultsConsumer.sol#L65
- Fetch game result: sports-api.js#L63
- Fulfill game result request ResultsConsumer.sol#L105
- Claim winnings SportsPredictionGame.sol#L151
6.1 Transfer winnings NativeTokenSender.sol#L66