-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: including ReentrancyAttack contract to test if the offer can be…
… accept twice in the same tx
- Loading branch information
1 parent
e5c211d
commit 6d0d99f
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.9; | ||
|
||
import '../OriumSftMarketplace.sol'; | ||
|
||
contract ReentrancyAttack { | ||
OriumSftMarketplace public marketplace; | ||
|
||
constructor(OriumSftMarketplace _marketplace) { | ||
marketplace = _marketplace; | ||
} | ||
|
||
receive() external payable {} | ||
|
||
function attemptDoubleAccept(RentalOffer calldata _offer, uint64 _duration) external payable { | ||
// First accept call | ||
marketplace.acceptRentalOffer{ value: msg.value / 2 }(_offer, _duration); | ||
// Second accept call in the same transaction | ||
marketplace.acceptRentalOffer{ value: msg.value / 2 }(_offer, _duration); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters