Betonchain Documentation
  • Bet with Betonchain
  • FAQ
  • Platform Reference
    • How Betonchain Works
    • Betonchain Frontend
    • Bookmaker Protocol to Decentralize the House Edge
    • Developers
      • Smart Contracts
      • API
    • Tokenomics, Staking and Incentives
      • Rewards Example
    • Betonchain DAO
    • Guides
  • Links
    • DApp
    • Contract Addresses
    • Socials
  • Resources
    • Terms of Service
Powered by GitBook
On this page
  • Child Bet Contracts
  • NFT Vouchers
  • Events
  • Examples
  • event RequestGameIdInit()
  • event RequestGameIdOdds()
  • event RequestGameIdResults()
  • event GameAdded()

Was this helpful?

  1. Platform Reference
  2. Developers

Smart Contracts

PreviousDevelopersNextAPI

Last updated 1 year ago

Was this helpful?

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 contracts to host risk-free bets for holders

  • And more!

Child Bet Contracts

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.

Events

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.

Parameter
Type
Description

requestId

bytes32 indexed

Request ID of the data request that was fulfilled

game_id

uint256

Game ID of the game for which data was initialized

event RequestGameIdOdds()

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

An event emitted when fulfillOdds() executes successfully.

Parameter
Type
Description

requestId

bytes32 indexed

Request ID of the data request that was fulfilled

game_id

uint256

Game ID of the game for which data was initialized

event RequestGameIdResults()

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

An event emitted when fulfillResults() executes successfully.

Parameter
Type
Description

requestId

bytes32 indexed

Request ID of the data request that was fulfilled

game_id

uint256

Game ID of the game for which data was initialized

event GameAdded()

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

An event emitted when _addGame() executes successfully.

Parameter
Type
Description

gameId

uint256

Game ID of the game that was added for betting

league

string

League of the game that was added for betting

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

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

The official DApp displays an event stream:

reach out
https://betonchain.gg/activity
Events
NFT voucher
Screen Shot from the Betonchain Node's Chainlink Operator UI