Smart Contracts

Using our contract infrastructure, developers can:

  • Analyze betting trends and access transparent odds, volume and game result data

  • Deploy a hedging contract for players to hedge parlays automatically

  • Develop a frontend on existing Betonchain contracts

  • Capture contract events to stream on social platforms

  • Deploy and fund our NFT voucher contracts to host risk-free bets for holders

  • And more!

Child Bet Contracts

You can access a wallet's bets by calling the functions below. The structs referenced below areMoneyLineBetJoin, OverUnderBetJoin andPointSpreadBetJoin. For relevant events see the Events section.

NFT Vouchers

Anyone can deploy and fund our NFT Voucher contracts to host risk-free bets for a specified scope of holders. The vouchers are compatible with both ERC721 and ERC1155 contract types.

  • The vouchers can be updated by their deployer and optionally support an array of IDs that allow subsets of NFT holders to qualify.

  • Vouchers accept funding in USDC, USDT or DAI for distributing risk-free bets after they're placed by qualified users through the Betonchain protocol.

  • The amount to distribute per bet and the interval over which to do so are required parameters. For example, one can specify that up to 100 USDC should be distributed in risk-free bets every 24 hours until funding is depleted.

Please reach out on our Discord for more details on NFT Vouchers and assistance with configuration and deployment.

Events

The official DApp displays an event stream: https://betonchain.gg/activity

Examples

import web3
import json

# endpoint, address, abi
PROVIDER_ENDPOINT = "https://eth-sepolia.g.alchemy.com/v2/..." 
CONTRACT_ADDRESS = "0x..."
with open("<abi_file_path>.json") as f:
    CONTRACT_ABI = json.load(f)
    
# web3 client
w3 = web3.Web3(web3.Web3.HTTPProvider(PROVIDER_ENDPOINT))

# example using BetML.sol contract 
ml_ct = w3.eth.contract(address=CONTRACT_ADDRESS, abi=CONTRACT_ABI)
ml_filter_results = ml_ct.events.MLBetResult.create_filter(fromBlock='latest')
ml_bet_results = ml_filter_results.get_all_entries()
# print logs
for log in ml_bet_results:
    print(log['args'], log['event'])

event RequestGameIdInit()

/* BetConsumer.sol */
event RequestGameIdInit(bytes32 indexed requestId, uint256 game_id);

An event emitted when fulfillInitGame() executes successfully.

event RequestGameIdOdds()

/* BetConsumer.sol */
event RequestGameIdOdds(bytes32 indexed requestId, uint256 game_id);

An event emitted when fulfillOdds() executes successfully.

event RequestGameIdResults()

/* BetConsumer.sol */
event RequestGameIdResults(bytes32 indexed requestId, uint256 game_id);

An event emitted when fulfillResults() executes successfully.

event GameAdded()

/* BetCore.sol */
event GameAdded(uint256 gameId, string league);

An event emitted when _addGame() executes successfully.

Last updated