From 065d167715a48c6b4329e24b6ead36231c21b038 Mon Sep 17 00:00:00 2001 From: jummy123 Date: Mon, 31 Jan 2022 15:29:27 +0000 Subject: [PATCH] incentives percent must be less than total --- contracts/LaunchEvent.sol | 4 ++++ test/LaunchEvent.test.js | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/contracts/LaunchEvent.sol b/contracts/LaunchEvent.sol index 38ffeda7..8872eecf 100644 --- a/contracts/LaunchEvent.sol +++ b/contracts/LaunchEvent.sol @@ -267,6 +267,10 @@ contract LaunchEvent { _maxAllocation > 0, "LaunchEvent: max allocation must not be zero" ); + require( + _tokenIncentivesPercent < 1 ether, + "LaunchEvent: token incentives too high" + ); issuer = _issuer; diff --git a/test/LaunchEvent.test.js b/test/LaunchEvent.test.js index 9a5f6729..d04dd189 100644 --- a/test/LaunchEvent.test.js +++ b/test/LaunchEvent.test.js @@ -179,6 +179,18 @@ describe("launch event contract initialisation", function () { ); }); + it("should revert if incentives percent too high", async function () { + const args = { + ...this.validParams, + _tokenIncentivesPercent: ethers.utils.parseEther("1"), + }; + await testReverts( + this.RocketFactory, + args, + "LaunchEvent: token incentives too high" + ); + }); + it("should revert if startime has elapsed", async function () { const args = { ...this.validParams,