From 19b1eb91559bffe9914e21277b0ed5cd373089e3 Mon Sep 17 00:00:00 2001 From: picodes Date: Mon, 5 Feb 2024 11:33:50 +0100 Subject: [PATCH] fix: signing --- contracts/DistributionCreator.sol | 4 ++-- contracts/utils/Errors.sol | 2 +- test/foundry/unit/DistributionCreator.t.sol | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/contracts/DistributionCreator.sol b/contracts/DistributionCreator.sol index 97f9b8d..c73ad64 100644 --- a/contracts/DistributionCreator.sol +++ b/contracts/DistributionCreator.sol @@ -455,8 +455,8 @@ contract DistributionCreator is UUPSHelper, ReentrancyGuardUpgradeable { uint256 rewardTokenMinAmount = rewardTokenMinAmounts[newCampaign.rewardToken]; // if epoch parameters lead to a past campaign if (newCampaign.startTimestamp < block.timestamp) revert CampaignSouldStartInFuture(); - // if the campaign doesn't last at least one second - if (newCampaign.duration == 0) revert CampaignDurationIsZero(); + // if the campaign doesn't last at least one hour + if (newCampaign.duration < HOUR) revert CampaignDurationBelowHour(); // if the reward token is not whitelisted as an incentive token if (rewardTokenMinAmount == 0) revert CampaignRewardTokenNotWhitelisted(); // if the amount distributed is too small with respect to what is allowed diff --git a/contracts/utils/Errors.sol b/contracts/utils/Errors.sol index 1463b9e..b2ddd9e 100644 --- a/contracts/utils/Errors.sol +++ b/contracts/utils/Errors.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.17; error CampaignDoesNotExist(); error CampaignAlreadyExists(); -error CampaignDurationIsZero(); +error CampaignDurationBelowHour(); error CampaignRewardTokenNotWhitelisted(); error CampaignRewardTooLow(); error CampaignSouldStartInFuture(); diff --git a/test/foundry/unit/DistributionCreator.t.sol b/test/foundry/unit/DistributionCreator.t.sol index 9410516..fc978df 100644 --- a/test/foundry/unit/DistributionCreator.t.sol +++ b/test/foundry/unit/DistributionCreator.t.sol @@ -162,7 +162,7 @@ contract Test_DistributionCreator_CreateDistribution is DistributionCreatorTest rewardId: keccak256("TEST"), additionalData: hex"" }); - vm.expectRevert(CampaignDurationIsZero.selector); + vm.expectRevert(CampaignDurationBelowHour.selector); vm.prank(alice); creator.createDistribution(distribution); @@ -377,7 +377,7 @@ contract Test_DistributionCreator_CreateCampaign is DistributionCreatorTest { startTimestamp: uint32(block.timestamp + 1), duration: 0 }); - vm.expectRevert(CampaignDurationIsZero.selector); + vm.expectRevert(CampaignDurationBelowHour.selector); vm.prank(alice); creator.createCampaign(campaign);