Skip to content

Commit

Permalink
fix:fixing require native token nft marketplace to ==
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardoMelo00 committed Aug 16, 2024
1 parent 77f2ddf commit c41a07c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion contracts/NftRentalMarketplace.sol
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ contract NftRentalMarketplace is Initializable, OwnableUpgradeable, PausableUpgr
) internal {
if (_feeTokenAddress == address(0)) {
uint256 totalFeeAmount = _feeAmountPerSecond * _duration;
require(msg.value >= totalFeeAmount, 'NftRentalMarketplace: Incorrect native token amount');
require(msg.value == totalFeeAmount, 'NftRentalMarketplace: Incorrect native token amount');

uint256 marketplaceFeeAmount = LibNftRentalMarketplace.getAmountFromPercentage(
totalFeeAmount,
Expand Down
3 changes: 2 additions & 1 deletion test/NftRentalMarketplace.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,13 +484,14 @@ describe('NftRentalMarketplace', () => {
.connect(operator)
.setTrustedFeeTokenForToken([rentalOffer.tokenAddress], [AddressZero], [true])
await marketplace.connect(lender).createRentalOffer(rentalOffer)
const totalFeeAmount = rentalOffer.feeAmountPerSecond * BigInt(duration)

const blockTimestamp = await time.latest()
const expirationDate = blockTimestamp + duration + 1

await expect(
marketplace.connect(borrower).acceptRentalOffer(rentalOffer, duration, {
value: totalFeeAmount.toString(),
value: totalFeeAmount,
}),
)
.to.emit(marketplace, 'RentalStarted')
Expand Down

0 comments on commit c41a07c

Please sign in to comment.