Skip to content
This repository has been archived by the owner on Dec 9, 2023. It is now read-only.

Latest commit

 

History

History
47 lines (34 loc) · 1.8 KB

README.md

File metadata and controls

47 lines (34 loc) · 1.8 KB

betting-system

This is the smart contract and frontend for the betting system for the VEX project. It runs on the testnet and has no DAO, oracle or FT associated with it.


Quickstart

  1. Make sure you have installed rust. (<1.70)
  2. Install the NEAR CLI

1. Start the contract

By running the below code the contract will be compiled, deployed and then the frontend launched.

chmod +x magic.sh
./magic.sh

2. Interact with the contract via the frontend

When not signed in, one can only view the current matches. Once the user signs in with a wallet then they can choose to bet on a match by selecting a team and an amount in NEAR to bet.

3. Interact with the contract via the CLI

Check the dev account the contract is deployed on

cat ./contract/neardev/dev-account
# e.g. dev-1659899566943-21539992274727

The contract can be used via the CLI with the following commands:

near call <dev account name> create_match '{"team_1": " ", "team_2": " ", "in_odds_1": " ", "in_odds_2": " ", "date": " "}' --accountId <dev account name>
near call <dev account name> end_betting '{"match_id": " "}' --accountId <dev account name>
near call <dev account name> finish_match '{"match_id": " ", "winning_team": " "}' --accountId <dev account name>
near call <dev account name> return_funds '{"match_id": " ", "state": " "}' --accountId <dev account name>
near call <dev account name> make_bet '{"match_id": " ", "decision": " "}' --amount 2 --accountId <your account name>
near view <dev account name> view_matches '{"match_id": " "}'
near view <dev account name> view_bets '{"match_id": " ", "name": " "}'
near view <dev account name> view_potential_winnings '{"match_id": " ", "team": " ", "bet_amount": " "}'