Skip to content

Commit

Permalink
feat: Validate start is not 0 (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
fzavalia authored Nov 22, 2022
1 parent 243ee6e commit b3fa99c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions contracts/PeriodicTokenVesting.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
9 changes: 9 additions & 0 deletions test/PeriodicTokenVesting.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down

0 comments on commit b3fa99c

Please sign in to comment.