diff --git a/contracts/contracts/DevRewardDistributor.sol b/contracts/contracts/DevRewardDistributor.sol index 744b15c..d75b31f 100644 --- a/contracts/contracts/DevRewardDistributor.sol +++ b/contracts/contracts/DevRewardDistributor.sol @@ -160,6 +160,7 @@ contract DevRewardDistributor { } function transfer(address to, uint256 value) external returns (bool) { + require(value > 0, "Value is 0"); require(lockedBalances[msg.sender].amount == value, "Invalid amount"); require(block.timestamp > lockedBalances[msg.sender].unlockTime, "Tokens are locked"); diff --git a/contracts/test/DevRewardDestributor.spec.ts b/contracts/test/DevRewardDestributor.spec.ts index 4ed650a..8909eb6 100644 --- a/contracts/test/DevRewardDestributor.spec.ts +++ b/contracts/test/DevRewardDestributor.spec.ts @@ -181,6 +181,8 @@ describe("DevRewardDistributor", () => { it("claim reward", async () => { let lastId = -1; for (let i = 0; i < 2; i++) { + const initTotalSupply = await rewardDistributor.totalSupply(); + const info = getRandomAccountInfo(lastId); lastId = info.accountId; @@ -220,6 +222,10 @@ describe("DevRewardDistributor", () => { ); expect(await rewardDistributor.isClaimed(info.accountId)).to.be.true; + + expect(await rewardDistributor.totalSupply()).to.eq( + initTotalSupply.add(reward) + ); } }); @@ -254,11 +260,16 @@ describe("DevRewardDistributor", () => { await ethers.provider.send("evm_increaseTime", [unlockTime.toNumber()]); + const totalSupply = await rewardDistributor.totalSupply(); const transferTx = await rewardDistributor.transfer( developerAccount.address, reward ); + expect(await rewardDistributor.totalSupply()).to.eq( + totalSupply.sub(reward) + ); + await expect(transferTx) .to.emit(token, "Transfer") .withArgs(rewardDistributor.address, developerAccount.address, reward);