как решить ошибку синтаксического анализа: Ожидаемое первичное выражение?

#mapping #blockchain #solidity #smartcontracts

Вопрос:

Полный источник:https://github.com/laronlineworld/bettingMatch/blob/main/bettingMatch.Solэто смарт-контракт для ставок, пытающийся создать структуру сопоставления, в которой пользователь/wallet_address может делать ставки на несколько матчей. Проблема этого контракта на ставки заключается в том, что каждый раз, когда пользователь/wallet_address делает ставку, данные одного сопоставления перезаписываются, как создать сопоставление значений, чтобы пользователь/wallet_address мог делать ставки на разные матчи.

Ошибка:контракты/BettingTestingGame.сол:123:73: Ошибка синтаксического анализа: Ожидаемое основное выражение. playerS.push(Игрок(msg.отправитель, _gameId, msg.значение, _teamSelected,)-1; ^

Функция для ставок:

 function bet(uint16 _gameId, uint8 _teamSelected) public payable {
  Game storage game = gameInfo[_gameId];

  require(game.state == State.Created,"Game has not been created");
  require(matchBettingActive[_gameId] == true);
  
  
  //The first require is used to check if the player already exist
  require(!checkPlayerExists(msg.sender));
  //The second one is used to see if the value sended by the player is
  //Higher than the minimum value
  require(msg.value >= minimumBet);

  //We set the player informations : amount of the bet and selected team
  Player storage playerS = playerInfo[msg.sender];
  playerS.push(Player(msg.sender, _gameId, msg.value, _teamSelected,)-1; 
  
  //add the mapping
  bytes32[] storage userBets = userToBets[msg.sender]; 
  userBets.push(_gameId);
// this only maps the playerinfo and every time player bets, it will overwrite  
//   playerInfo[playerS].amountBet = msg.value;
//   playerInfo[playerS].teamSelected = _teamSelected;

  //then we add the address of the player to the players array
  players.push(msg.sender);

  //at the end, we increment the stakes of the team selected with the player bet
  if ( _teamSelected == 1){
      totalBetsOne  = msg.value;
  }
  else{
      totalBetsTwo  = msg.value;
  }
}
 

Необходимо синхронизировать данные о распределении приза:

 // Generates a number between 1 and 10 that will be the winner
function distributePrizes(uint _gameId, uint16 teamWinner) public onlyOwner {
    
  Game storage game = gameInfo[_gameId];
  
  require(bettingActive == false);
  address[1000] memory winners;
  //We have to create a temporary in memory array with fixed size
  //Let's choose 1000
  uint256 count = 0; // This is the count for the array of winners
  uint256 LoserBet = 0; //This will take the value of all losers bet
  uint256 WinnerBet = 0; //This will take the value of all winners bet


  //We loop through the player array to check who selected the winner team
  for(uint256 i = 0; i < players.length; i  ){
     address playerAddress = players[i];

     //If the player selected the winner team
     //We add his address to the winners array
     if(playerInfo[playerAddress].teamSelected == teamWinner){
        winners[count] = playerAddress;
        count  ;
     }
  }

  //We define which bet sum is the Loser one and which one is the winner
  if ( teamWinner == 1){
     LoserBet = totalBetsTwo;
     WinnerBet = totalBetsOne;
  }
  else{
      LoserBet = totalBetsOne;
      WinnerBet = totalBetsTwo;
  }


  //We loop through the array of winners, to give ethers to the winners
  for(uint256 j = 0; j < count; j  ){
      // Check that the address in this fixed array is not empty
     if(winners[j] != address(0))
        address add = winners[j];
        uint256 bets = playerInfo[add].amountBet;
        //Transfer the money to the user
        winners[j].transfer(    (bets*(10000 (LoserBet*devFee/WinnerBet)))/10000 );
  }
  delete playerInfo[playerAddress]; // Delete all the players
  players.length = 0; // Delete all the players array
  LoserBet = 0; //reinitialize the bets
  WinnerBet = 0;
  totalBetsOne = 0;
  totalBetsTwo = 0;
  
  game.state == State.Finished;
}