From 98dd76c122ff5dc0c65ba51fa302b611be78f1a9 Mon Sep 17 00:00:00 2001 From: Andres Aiello Date: Wed, 6 Nov 2024 14:12:47 -0300 Subject: [PATCH] add validations --- .../instant-rewards/InstantRewardsFactory.sol | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/zevm-app-contracts/contracts/instant-rewards/InstantRewardsFactory.sol b/packages/zevm-app-contracts/contracts/instant-rewards/InstantRewardsFactory.sol index 0c69f89..3a0560f 100644 --- a/packages/zevm-app-contracts/contracts/instant-rewards/InstantRewardsFactory.sol +++ b/packages/zevm-app-contracts/contracts/instant-rewards/InstantRewardsFactory.sol @@ -8,6 +8,11 @@ contract InstantRewardsFactory is Ownable2Step { bool public allowPublicCreation = false; error AccessDenied(); + error InvalidSignerAddress(); + error EmptyName(); + error StartTimeInPast(); + error EndTimeBeforeStart(); + event InstantRewardsCreated(address indexed instantRewards, address indexed owner); constructor(address owner) Ownable() { @@ -24,6 +29,11 @@ contract InstantRewardsFactory is Ownable2Step { uint256 end, string memory name ) external returns (address) { + if (signerAddress == address(0)) revert InvalidSignerAddress(); + if (bytes(name).length == 0) revert EmptyName(); + if (start < block.timestamp) revert StartTimeInPast(); + if (end <= start) revert EndTimeBeforeStart(); + bool isOwner = owner() == msg.sender; if (!allowPublicCreation && !isOwner) revert AccessDenied();