Skip to content

Commit f037661

Browse files
committed
check for Allowance
1 parent 9692786 commit f037661

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/theHall/theHall.sol

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ contract TheHall is ReentrancyGuard, Pausable, Ownable {
3131
error NotApproved();
3232
error InvalidAmount();
3333
error SellerCannotBeBuyer();
34+
error InsufficientAllowance();
3435

3536
struct Listing {
3637
address seller;
@@ -100,6 +101,9 @@ contract TheHall is ReentrancyGuard, Pausable, Ownable {
100101
(address recv, uint256 royalty) = sToken.royaltyInfo(id, lst.price);
101102
if (royalty == 0) revert InvalidAmount();
102103

104+
uint256 allowance = currency.allowance(msg.sender, address(this));
105+
if (allowance < lst.price) revert InsufficientAllowance();
106+
103107
delete listings[id];
104108

105109
currency.safeTransferFrom(msg.sender, recv, royalty);

0 commit comments

Comments
 (0)