creation_sourcecode: // SPDX-License-Identifier: MIT
  pragma solidity ^0.8.0;
  
  contract UFCBetting {
      struct Bet {
          address payable bettor;
          uint amount;
          bool onFighterA;
      }
      
      address public owner;
      uint public houseFee = 1; // 1%
      uint public totalBetFighterA;
      uint public totalBetFighterB;
      uint public oddsFighterA; // odds in percentage (e.g., 150 means 1.50 odds)
      uint public oddsFighterB; // odds in percentage (e.g., 200 means 2.00 odds)
      Bet[] public bets;
      bool public bettingOpen = true;
      bool public fightDecided = false;
      bool public fighterAWon;
      
      constructor() {
          owner = msg.sender;
      }
      
      modifier onlyOwner() {
          require(msg.sender == owner, "Only the owner can perform this action.");
          _;
      }
      
      modifier bettingIsOpen() {
          require(bettingOpen, "Betting is closed.");
          _;
      }
      
      function setOdds(uint _oddsFighterA, uint _oddsFighterB) external onlyOwner {
          require(bettingOpen, "Cannot set odds after betting is closed.");
          oddsFighterA = _oddsFighterA;
          oddsFighterB = _oddsFighterB;
      }
      
      function placeBet(bool onFighterA) external payable bettingIsOpen {
          require(msg.value > 0, "Bet amount must be greater than 0.");
          
          bets.push(Bet({
              bettor: payable(msg.sender),
              amount: msg.value,
              onFighterA: onFighterA
          }));
          
          if (onFighterA) {
              totalBetFighterA += msg.value;
          } else {
              totalBetFighterB += msg.value;
          }
      }
      
      function closeBetting() external onlyOwner {
          bettingOpen = false;
      }
      
      function decideFight(bool _fighterAWon) external onlyOwner {
          require(!fightDecided, "Fight already decided.");
          require(!bettingOpen, "Betting is still open.");
          
          fightDecided = true;
          fighterAWon = _fighterAWon;
          
          uint totalPool = totalBetFighterA + totalBetFighterB;
          uint houseCut = (totalPool * houseFee) / 100;
          
          for (uint i = 0; i < bets.length; i++) {
              if (bets[i].onFighterA == fighterAWon) {
                  uint payout;
                  if (fighterAWon) {
                      payout = (bets[i].amount * oddsFighterA) / 100;
                  } else {
                      payout = (bets[i].amount * oddsFighterB) / 100;
                  }
                  bets[i].bettor.transfer(payout);
              }
          }
          
          payable(owner).transfer(houseCut);
      }
      
      function withdraw() external onlyOwner {
          require(fightDecided, "Fight not yet decided.");
          payable(owner).transfer(address(this).balance);
      }
      
      function getBetCount() external view returns (uint) {
          return bets.length;
      }
  
      function WithdrawStuckETH(address payable to, uint256 amount) external onlyOwner {
          require(amount <= address(this).balance, "Insufficient balance");
          require(to != address(0), "Invalid address");
          to.transfer(amount);
      }
  }