Skip to content

Commit

Permalink
remove _transferOrBust
Browse files Browse the repository at this point in the history
  • Loading branch information
kevincharm committed Sep 5, 2024
1 parent eef50e4 commit cdb3eae
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions contracts/Lootery.sol
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ contract Lootery is
// Jackpot is shared between all tickets
// Invariant: `ticketsSold[gameId] > 0`
uint256 prizeShare = unclaimedPayouts / game.ticketsSold;
_transferOrBust(whomst, prizeShare);
IERC20(prizeToken).safeTransfer(whomst, prizeShare);
emit ConsolationClaimed(tokenId, ticket.gameId, whomst, prizeShare);
return;
}
Expand All @@ -535,7 +535,7 @@ contract Lootery is
// Record that this ticket has claimed its winnings
claimedWinningTickets[ticket.gameId].push(tokenId);
// Transfer share of jackpot to ticket holder
_transferOrBust(whomst, prizeShare);
IERC20(prizeToken).safeTransfer(whomst, prizeShare);

emit WinningsClaimed(tokenId, ticket.gameId, whomst, prizeShare);
return;
Expand All @@ -548,7 +548,7 @@ contract Lootery is
function withdrawAccruedFees() external onlyOwner {
uint256 totalAccrued = accruedCommunityFees;
accruedCommunityFees = 0;
_transferOrBust(msg.sender, totalAccrued);
IERC20(prizeToken).safeTransfer(msg.sender, totalAccrued);
}

/// @notice Set this game as the last game of the lottery.
Expand Down Expand Up @@ -588,13 +588,6 @@ contract Lootery is
IERC20(tokenAddress).safeTransfer(msg.sender, amount);
}

/// @notice Helper to transfer the `prizeToken`.
/// @param to Address to transfer to
/// @param value Value (in wei) to transfer
function _transferOrBust(address to, uint256 value) internal {
IERC20(prizeToken).safeTransfer(to, value);
}

/// @notice Helper to parse a pick id into a pick array
/// @param pickId Pick id
function computePicks(
Expand Down

0 comments on commit cdb3eae

Please sign in to comment.