Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: SpotlightRewardsVault withdraw add nonReentrant #26

Merged
merged 1 commit into from
Feb 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/spotlight-rewards-vault/SpotlightRewardsVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ pragma solidity ^0.8.13;
import {ISpotlightRewardsVault} from "./ISpotlightRewardsVault.sol";
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {ReentrancyGuardTransient} from "@openzeppelin/contracts/utils/ReentrancyGuardTransient.sol";
import {IMinimalIPAccount} from "../interfaces/IMinimalIPAccount.sol";

/*
* @dev Manager of deposits & withdrawals for protocol rewards
*/
contract SpotlightRewardsVault is ISpotlightRewardsVault, Ownable {

contract SpotlightRewardsVault is ISpotlightRewardsVault, Ownable, ReentrancyGuardTransient {
constructor() payable Ownable(msg.sender) {}

mapping(address => mapping(uint256 => uint256)) internal _rewards;
Expand Down Expand Up @@ -59,7 +60,7 @@ contract SpotlightRewardsVault is ISpotlightRewardsVault, Ownable {
*
* @param ipAccount The IPAccount to withdraw rewards from
*/
function withdraw(address ipAccount) external onlyWithdrawEnabled {
function withdraw(address ipAccount) external onlyWithdrawEnabled nonReentrant {
if (ipAccount == address(0)) revert AddressZero();

(, address tokenContract, uint256 tokenId) = _getToken(ipAccount);
Expand All @@ -81,7 +82,7 @@ contract SpotlightRewardsVault is ISpotlightRewardsVault, Ownable {
*
* @param ipAccounts Array of IPAccounts to withdraw rewards from
*/
function withdrawAll(address[] calldata ipAccounts) external onlyWithdrawEnabled {
function withdrawAll(address[] calldata ipAccounts) external onlyWithdrawEnabled nonReentrant {
if (ipAccounts.length == 0) revert IPAccountsEmpty();

uint256 totalAmount;
Expand Down