Skip to content

smartcontractkit/prediction-game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rugby Prediction Game

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.

Requirements

  • Node.js version 18 or higher

Getting Started

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.

Solution Overview

Solution

Code references:

  1. Predict game result: PredictionGame.sol#L116
  2. Check for finished games: PredictionGame.sol#379
  3. Request game result: ResultsConsumer.sol#L65
  4. Fetch game result: sports-api.js#L63
  5. Fulfill game result request ResultsConsumer.sol#L105
  6. Claim winnings SportsPredictionGame.sol#L151
    6.1 Transfer winnings NativeTokenSender.sol#L66

Resources

About

Rugby prediction game using Chainlink Functions, Automation, and CCIP.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •