Skip to content

Commit

Permalink
Update sum-tree after prize awarded
Browse files Browse the repository at this point in the history
  • Loading branch information
robsecord committed Aug 11, 2020
1 parent 731eb69 commit 2cada74
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion contracts/prize-strategy/PrizeStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -497,10 +497,12 @@ contract PrizeStrategy is PrizeStrategyStorage,
/// @param user The user to whom the tickets are minted
/// @param amount The amount of interest to mint as tickets.
function _awardTickets(address user, uint256 amount) internal {
_accrueCredit(user, ticket.balanceOf(user));
uint256 userBalance = ticket.balanceOf(user);
_accrueCredit(user, userBalance);
uint256 creditEarned = _calculateEarlyExitFee(amount);
creditBalances[user].balance = uint256(creditBalances[user].balance).add(creditEarned).toUint128();
prizePool.award(user, amount, address(ticket));
sortitionSumTrees.set(TREE_KEY, userBalance.add(amount), bytes32(uint256(user)));
}

/// @notice Awards all external tokens with non-zero balances to the given user. The external tokens must be held by the PrizePool contract.
Expand Down

0 comments on commit 2cada74

Please sign in to comment.