Skip to content

Commit

Permalink
Merge pull request #2 from 0xBabacan/main
Browse files Browse the repository at this point in the history
Set a fee for refereee and contract owner
  • Loading branch information
luloxi committed Jan 6, 2024
2 parents 3dbbcf4 + dc615d3 commit a7a45e1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/hardhat/contracts/Sportsbook.sol
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ contract Sportsbook {
matchChallenges[_challengeId].team1Result = _team1Result;
matchChallenges[_challengeId].team2Result = _team2Result;
matchChallenges[_challengeId].state = MatchState.FINISHED;
uint256 refereeFee = matchChallenges[_challengeId].bet * 5 / 100;
(bool success,) = payable(msg.sender).call{value: refereeFee}("");
require(success, "Transfer failed.");
matchChallenges[_challengeId].bet -= refereeFee;
emit ChallengeResult(
_challengeId,
matchChallenges[_challengeId].team1,
Expand Down

0 comments on commit a7a45e1

Please sign in to comment.