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.
By running the below code the contract will be compiled, deployed and then the frontend launched.
chmod +x magic.sh
./magic.sh
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.
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": " "}'