Skip to content

Commit

Permalink
Updated with Lens feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
mvanhalen committed Jan 10, 2024
1 parent 62cce41 commit f962ab3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 21 deletions.
20 changes: 4 additions & 16 deletions contracts/TipActionModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pragma solidity ^0.8.19;
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {Types} from "./libraries/Types.sol";
import {IPublicationActionModule} from "./interfaces/IPublicationActionModule.sol";
import {HubRestricted} from "./base/HubRestricted.sol";
Expand All @@ -21,15 +20,13 @@ contract TipActionModule is
Ownable,
HubRestricted,
LensModuleMetadata,
LensModuleRegistrant,
ReentrancyGuard
LensModuleRegistrant
{
using SafeERC20 for IERC20;

error CurrencyNotWhitelisted();
error TipAmountCannotBeZero();
error TipReceiverNotProvided();
error TipAmountNotApproved();
error TipAmountCannotBeZero();

event TipReceiverRegistered(
uint256 indexed profileId,
Expand Down Expand Up @@ -107,7 +104,7 @@ contract TipActionModule is

function processPublicationAction(
Types.ProcessActionParams calldata params
) external override onlyHub nonReentrant returns (bytes memory) {
) external override onlyHub returns (bytes memory) {
(address currency, uint256 tipAmount) = abi.decode(
params.actionModuleData,
(address, uint256)
Expand All @@ -127,15 +124,6 @@ contract TipActionModule is

IERC20 token = IERC20(currency);

uint256 allowance = token.allowance(
params.transactionExecutor,
address(this)
);

if (allowance < tipAmount) {
revert TipAmountNotApproved();
}

emit TipCreated(
params.transactionExecutor,
tipReceiver,
Expand All @@ -151,4 +139,4 @@ contract TipActionModule is

return abi.encode(tipReceiver, currency, tipAmount);
}
}
}
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
"author": "Martijn van Halen and Paul Burke",
"license": "MIT",
"dependencies": {
"@openzeppelin/contracts": "^5.0.1"
"@openzeppelin/contracts": "^4.8.1"
}
}

0 comments on commit f962ab3

Please sign in to comment.