From 4b1aa1e982d016b67655c6c0b383d1bd8007ab41 Mon Sep 17 00:00:00 2001 From: Jeremy Lee Date: Sat, 14 Feb 2026 20:16:20 -0500 Subject: [PATCH 1/2] convert raffle tickets to pp --- plume/src/spin/Spin.sol | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/plume/src/spin/Spin.sol b/plume/src/spin/Spin.sol index 748e8f90..8dc08199 100644 --- a/plume/src/spin/Spin.sol +++ b/plume/src/spin/Spin.sol @@ -73,6 +73,7 @@ contract Spin is event SpinCompleted(address indexed walletAddress, string rewardCategory, uint256 rewardAmount); event RaffleTicketsSpent(address indexed walletAddress, uint256 ticketsUsed, uint256 remainingTickets); event RaffleTicketsAdded(address indexed walletAddress, uint256 ticketsAdded, uint256 newBalance); + event RaffleTicketsConvertedToPP(address indexed walletAddress, uint256 ticketsSpent, uint256 ppGained); event NotEnoughStreak(string message); event JackpotAlreadyClaimed(string message); @@ -361,6 +362,23 @@ contract Spin is emit RaffleTicketsAdded(user, amount, userDataStorage.raffleTicketsBalance); } + /// @notice Converts all of a user's raffle tickets to PP (10 tickets = 1 PP, rounded up). + /// @param user The address of the user whose tickets should be converted. + function convertRaffleTicketsToPP(address user) external onlyRole(ADMIN_ROLE) { + require(user != address(0), "Invalid user address"); + UserData storage userDataStorage = userData[user]; + uint256 ticketsToConvert = userDataStorage.raffleTicketsBalance; + require(ticketsToConvert > 0, "No raffle tickets to convert"); + + // Calculate PP gained: 10 tickets = 1 PP, rounded up + uint256 ppGained = (ticketsToConvert + 9) / 10; + + userDataStorage.raffleTicketsBalance = 0; + userDataStorage.PPGained += ppGained; + + emit RaffleTicketsConvertedToPP(user, ticketsToConvert, ppGained); + } + /// @notice Allows the admin to withdraw PLUME tokens from the contract. function adminWithdraw(address payable recipient, uint256 amount) external onlyRole(ADMIN_ROLE) { require(recipient != address(0), "Invalid recipient address"); From 27647e85f37f2e517eb511a7a684bee789ffb1bf Mon Sep 17 00:00:00 2001 From: Jeremy Lee Date: Sat, 14 Feb 2026 20:18:49 -0500 Subject: [PATCH 2/2] dont add pp gained to user stats --- plume/src/spin/Spin.sol | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/plume/src/spin/Spin.sol b/plume/src/spin/Spin.sol index 8dc08199..5312a904 100644 --- a/plume/src/spin/Spin.sol +++ b/plume/src/spin/Spin.sol @@ -362,11 +362,9 @@ contract Spin is emit RaffleTicketsAdded(user, amount, userDataStorage.raffleTicketsBalance); } - /// @notice Converts all of a user's raffle tickets to PP (10 tickets = 1 PP, rounded up). - /// @param user The address of the user whose tickets should be converted. - function convertRaffleTicketsToPP(address user) external onlyRole(ADMIN_ROLE) { - require(user != address(0), "Invalid user address"); - UserData storage userDataStorage = userData[user]; + /// @notice Converts all of the caller's raffle tickets to PP (10 tickets = 1 PP, rounded up). + function convertRaffleTicketsToPP() external { + UserData storage userDataStorage = userData[msg.sender]; uint256 ticketsToConvert = userDataStorage.raffleTicketsBalance; require(ticketsToConvert > 0, "No raffle tickets to convert"); @@ -374,9 +372,8 @@ contract Spin is uint256 ppGained = (ticketsToConvert + 9) / 10; userDataStorage.raffleTicketsBalance = 0; - userDataStorage.PPGained += ppGained; - emit RaffleTicketsConvertedToPP(user, ticketsToConvert, ppGained); + emit RaffleTicketsConvertedToPP(msg.sender, ticketsToConvert, ppGained); } /// @notice Allows the admin to withdraw PLUME tokens from the contract.