From bcff84ed40aa19ed34e70190d7a9f20de306c30f Mon Sep 17 00:00:00 2001 From: nour-karoui Date: Thu, 26 Oct 2023 15:40:42 +0100 Subject: [PATCH] fix event argument type and add test for checking event emitting --- src/crowdsale/CrowdSale.sol | 2 +- test/CrowdSale.t.sol | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/crowdsale/CrowdSale.sol b/src/crowdsale/CrowdSale.sol index d6e8edd2..deedb7aa 100644 --- a/src/crowdsale/CrowdSale.sol +++ b/src/crowdsale/CrowdSale.sol @@ -83,7 +83,7 @@ contract CrowdSale is ReentrancyGuard, Ownable { /// @notice emitted when sales owner / beneficiary claims `salesAmount` `auctionTokens` after a non successful sale event ClaimedAuctionTokens(uint256 indexed saleId); - event FeesUpdated(uint256 feeBp); + event FeesUpdated(uint16 feeBp); constructor() Ownable() { } diff --git a/test/CrowdSale.t.sol b/test/CrowdSale.t.sol index 59282ad8..ae31a2df 100644 --- a/test/CrowdSale.t.sol +++ b/test/CrowdSale.t.sol @@ -37,6 +37,8 @@ contract CrowdSaleTest is Test { FakeERC20 internal biddingToken; CrowdSale internal crowdSale; + event FeesUpdated(uint16 feeBp); + function setUp() public { vm.startPrank(deployer); crowdSale = new CrowdSale(); @@ -71,6 +73,8 @@ contract CrowdSaleTest is Test { crowdSale.setCurrentFeesBp(5001); //10% + vm.expectEmit(true, true, true, true, address(crowdSale)); + emit FeesUpdated(1000); crowdSale.setCurrentFeesBp(1000); assertEq(crowdSale.currentFeeBp(), 1000); vm.stopPrank();