From 3a18e4b30861eda859543e9755dd3dfa4d16300d Mon Sep 17 00:00:00 2001 From: malteish Date: Tue, 19 Sep 2023 17:27:21 +0200 Subject: [PATCH] add test --- test/ContinuousFundraising.t.sol | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/test/ContinuousFundraising.t.sol b/test/ContinuousFundraising.t.sol index 61131c0e..eee9266c 100644 --- a/test/ContinuousFundraising.t.sol +++ b/test/ContinuousFundraising.t.sol @@ -96,6 +96,35 @@ contract ContinuousFundraisingTest is Test { paymentToken.approve(address(raise), paymentTokenAmount); } + function testLogicContractCreation(address forwarder) public { + vm.assume(forwarder != address(0)); + ContinuousFundraising _logic = new ContinuousFundraising(forwarder); + + console.log("address of logic contract: ", address(_logic)); + + // try to initialize + vm.expectRevert("Initializable: contract is already initialized"); + _logic.initialize( + address(this), + payable(receiver), + minAmountPerBuyer, + maxAmountPerBuyer, + price, + maxAmountOfTokenToBeSold, + paymentToken, + token + ); + + // owner and all settings are 0 + assertTrue(_logic.owner() == address(0), "owner is not 0"); + assertTrue(_logic.currencyReceiver() == address(0)); + assertTrue(_logic.minAmountPerBuyer() == 0); + assertTrue(_logic.maxAmountPerBuyer() == 0); + assertTrue(_logic.tokenPrice() == 0); + assertTrue(address(_logic.currency()) == address(0)); + assertTrue(address(_logic.token()) == address(0)); + } + function testConstructorHappyCase() public { ContinuousFundraising _raise = ContinuousFundraising( factory.createContinuousFundraisingClone(