diff --git a/contracts/PeriodicTokenVesting.sol b/contracts/PeriodicTokenVesting.sol index e0d6457..33425f5 100644 --- a/contracts/PeriodicTokenVesting.sol +++ b/contracts/PeriodicTokenVesting.sol @@ -108,6 +108,8 @@ contract PeriodicTokenVesting is OwnableUpgradeable, PausableUpgradeable { "PeriodicTokenVesting#initialize: INVALID_TOKEN" ); + require(_start != 0, "PeriodicTokenVesting#initialize: INVALID_START"); + require( _period != 0, "PeriodicTokenVesting#initialize: INVALID_PERIOD_DURATION" diff --git a/test/PeriodicTokenVesting.spec.js b/test/PeriodicTokenVesting.spec.js index 9c7f583..c114d90 100644 --- a/test/PeriodicTokenVesting.spec.js +++ b/test/PeriodicTokenVesting.spec.js @@ -171,6 +171,15 @@ describe("PeriodicTokenVesting", () => { "PeriodicTokenVesting#initialize: INVALID_VESTED_PER_PERIOD_LENGTH" ); }); + + it("reverts when start is 0", async () => { + initParams.start = 0; + initParamsList = Object.values(initParams); + + await expect(vesting.initialize(...initParamsList)).to.be.revertedWith( + "PeriodicTokenVesting#initialize: INVALID_START" + ); + }); }); describe("getTotal", () => {