Skip to content

Commit

Permalink
fix: removing nooReentrancy
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardoMelo00 committed Aug 13, 2024
1 parent 0f115d1 commit e5c211d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 30 deletions.
13 changes: 2 additions & 11 deletions contracts/NftRentalMarketplace.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@ import { IOriumMarketplaceRoyalties } from './interfaces/IOriumMarketplaceRoyalt
import { OwnableUpgradeable } from '@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol';
import { Initializable } from '@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol';
import { PausableUpgradeable } from '@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol';
import { ReentrancyGuardUpgradeable } from '@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol';
import { LibNftRentalMarketplace, RentalOffer, Rental } from './libraries/LibNftRentalMarketplace.sol';

/**
* @title Orium NFT Marketplace - Marketplace for renting NFTs
* @dev This contract is used to manage NFTs rentals, powered by ERC-7432 Non-Fungible Token Roles
* @author Orium Network Team - [email protected]
*/
contract NftRentalMarketplace is Initializable, OwnableUpgradeable, PausableUpgradeable, ReentrancyGuardUpgradeable {
contract NftRentalMarketplace is Initializable, OwnableUpgradeable, PausableUpgradeable {
/** ######### Global Variables ########### **/

/// @dev oriumMarketplaceRoyalties stores the collection royalties and fees
Expand Down Expand Up @@ -99,14 +98,6 @@ contract NftRentalMarketplace is Initializable, OwnableUpgradeable, PausableUpgr
transferOwnership(_owner);
}

/**
* @notice Initializes the reentrancy guard for the new version.
* @dev This function can only be called once, after the contract upgrade.
*/
function initializeV2() external reinitializer(2) {
__ReentrancyGuard_init();
}

/** ============================ Rental Functions ================================== **/

/** ######### Setters ########### **/
Expand Down Expand Up @@ -158,7 +149,7 @@ contract NftRentalMarketplace is Initializable, OwnableUpgradeable, PausableUpgr
function acceptRentalOffer(
RentalOffer calldata _offer,
uint64 _duration
) external payable whenNotPaused nonReentrant {
) external payable whenNotPaused {
bytes32 _offerHash = LibNftRentalMarketplace.hashRentalOffer(_offer);
uint64 _expirationDate = uint64(block.timestamp + _duration);
LibNftRentalMarketplace.validateAcceptRentalOfferParams(
Expand Down
13 changes: 2 additions & 11 deletions contracts/OriumSftMarketplace.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ pragma solidity 0.8.9;
import { OwnableUpgradeable } from '@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol';
import { Initializable } from '@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol';
import { PausableUpgradeable } from '@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol';
import { ReentrancyGuardUpgradeable } from '@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol';
import { IERC1155 } from '@openzeppelin/contracts/token/ERC1155/IERC1155.sol';
import { IERC7589 } from './interfaces/IERC7589.sol';
import { IERC7589Legacy } from './interfaces/IERC7589Legacy.sol';
Expand All @@ -17,7 +16,7 @@ import { IOriumMarketplaceRoyalties } from './interfaces/IOriumMarketplaceRoyalt
* @dev This contract is used to manage SFTs rentals, powered by ERC-7589 Semi-Fungible Token Roles
* @author Orium Network Team - [email protected]
*/
contract OriumSftMarketplace is Initializable, OwnableUpgradeable, PausableUpgradeable, ReentrancyGuardUpgradeable {
contract OriumSftMarketplace is Initializable, OwnableUpgradeable, PausableUpgradeable {
/** ######### Global Variables ########### **/

/// @dev oriumMarketplaceRoyalties stores the collection royalties and fees
Expand Down Expand Up @@ -117,14 +116,6 @@ contract OriumSftMarketplace is Initializable, OwnableUpgradeable, PausableUpgra
transferOwnership(_owner);
}

/**
* @notice Initializes the reentrancy guard for the new version.
* @dev This function can only be called once, after the contract upgrade.
*/
function initializeV2() external reinitializer(2) {
__ReentrancyGuard_init();
}

/** ============================ Rental Functions ================================== **/

/** ######### Setters ########### **/
Expand Down Expand Up @@ -179,7 +170,7 @@ contract OriumSftMarketplace is Initializable, OwnableUpgradeable, PausableUpgra
function acceptRentalOffer(
RentalOffer calldata _offer,
uint64 _duration
) external payable whenNotPaused nonReentrant {
) external payable whenNotPaused {
bytes32 _offerHash = LibOriumSftMarketplace.hashRentalOffer(_offer);
uint64 _expirationDate = uint64(block.timestamp + _duration);
LibOriumSftMarketplace.validateAcceptRentalOffer(
Expand Down
4 changes: 0 additions & 4 deletions test/NftRentalMarketplace.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1049,10 +1049,6 @@ describe('NftRentalMarketplace', () => {
'Initializable: contract is already initialized',
)
})
it('Should NOT initialize the contract with initializeV2 if already initialized', async () => {
await marketplace.initializeV2()
await expect(marketplace.initializeV2()).to.be.revertedWith('Initializable: contract is already initialized')
})
})
describe('Pausable', async () => {
describe('Pause', async () => {
Expand Down
4 changes: 0 additions & 4 deletions test/OriumSftMarketplace.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1608,10 +1608,6 @@ describe('OriumSftMarketplace', () => {
'Initializable: contract is already initialized',
)
})
it('Should NOT initialize the contract with initializeV2 if already initialized', async () => {
await marketplace.initializeV2()
await expect(marketplace.initializeV2()).to.be.revertedWith('Initializable: contract is already initialized')
})
})

describe('Pausable', async () => {
Expand Down

0 comments on commit e5c211d

Please sign in to comment.