From f3803568937cdbf83369b596e41a705ada0ca079 Mon Sep 17 00:00:00 2001 From: owen05 Date: Wed, 6 Jan 2021 00:26:53 +0800 Subject: [PATCH] fix incentive --- contracts/SmartRoute/DODOIncentive.sol | 6 +++--- test/Proxy/proxy.incentive.test.ts | 12 ++---------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/contracts/SmartRoute/DODOIncentive.sol b/contracts/SmartRoute/DODOIncentive.sol index d3c865b..fc4328d 100644 --- a/contracts/SmartRoute/DODOIncentive.sol +++ b/contracts/SmartRoute/DODOIncentive.sol @@ -48,13 +48,13 @@ contract DODOIncentive is InitializableOwnable { function switchIncentive(uint256 _startBlock) public onlyOwner { if(startBlock != 0) { require(block.number >= startBlock); + _update(); startBlock = 0; }else { - require(block.number <= _startBlock); + require(block.number <= _startBlock && _startBlock < uint32(-1)); startBlock = _startBlock; - lastRewardBlock = startBlock; + lastRewardBlock = uint32(_startBlock); } - _update(); emit SetSwitch(startBlock == 0 ? false: true); } diff --git a/test/Proxy/proxy.incentive.test.ts b/test/Proxy/proxy.incentive.test.ts index 312c092..76d840c 100644 --- a/test/Proxy/proxy.incentive.test.ts +++ b/test/Proxy/proxy.incentive.test.ts @@ -104,19 +104,11 @@ describe("DODOProxyV2.0", () => { describe("DODOIncentive", () => { - it("incentive-switch", async () => { + it("incentive-switch with trade", async () => { }); - it("incentive-changeBoost", async () => { - - }); - - it("incentive-changeDefaultRate", async () => { - - }); - - it("incentive-emptyReward", async () => { + it("incentive-changeBoost with trade", async () => { });