Skip to content

Commit

Permalink
fix: delete recursive
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardoMelo00 committed Aug 14, 2024
1 parent b602f4d commit 51509d0
Showing 1 changed file with 0 additions and 27 deletions.
27 changes: 0 additions & 27 deletions test/OriumSftMarketplace.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -752,33 +752,6 @@ describe('OriumSftMarketplace', () => {
).to.be.revertedWith('OriumSftMarketplace: This offer has an ongoing rental')
})

it('should revert on multiple reentrant calls', async () => {
const AttackContract = await ethers.getContractFactory('ReentrancyAttack')
attackContract = (await AttackContract.deploy(marketplace)) as ReentrancyAttack
await attackContract.waitForDeployment()

await marketplaceRoyalties
.connect(operator)
.setTrustedFeeTokenForToken([rentalOffer.tokenAddress], [AddressZero], [true])

rentalOffer.feeTokenAddress = AddressZero
rentalOffer.feeAmountPerSecond = toWei('0.0000001')
const totalFeeAmount = rentalOffer.feeAmountPerSecond * BigInt(duration)
rentalOffer.nonce = `0x${randomBytes(32).toString('hex')}`
await marketplace.connect(lender).createRentalOffer({ ...rentalOffer, commitmentId: BigInt(0) })
rentalOffer.commitmentId = BigInt(2)

await borrower.sendTransaction({
to: attackContract.getAddress(),
value: toWei('100'),
})

// Attempt the attack
await expect(
attackContract.attackWithRecursiveCalls(rentalOffer, duration, 5, { value: totalFeeAmount }),
).to.be.revertedWith('OriumSftMarketplace: Insufficient native token amount')
})

describe('Fees', async function () {
const feeAmountPerSecond = toWei('1')
const feeAmount = feeAmountPerSecond * BigInt(duration)
Expand Down

0 comments on commit 51509d0

Please sign in to comment.