-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix bmcj div by zero * Fix code style issues with Prettier --------- Co-authored-by: Lint Action <[email protected]>
- Loading branch information
1 parent
5df7846
commit 405de79
Showing
2 changed files
with
57 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma experimental ABIEncoderV2; | ||
pragma solidity 0.6.12; | ||
|
||
import "forge-std/Test.sol"; | ||
|
||
import "@openzeppelin/contracts/proxy/ProxyAdmin.sol"; | ||
import "@openzeppelin/contracts/proxy/TransparentUpgradeableProxy.sol"; | ||
|
||
import "../../contracts/BoostedMasterChefJoe.sol"; | ||
|
||
contract TestUpgradeBMCJ is Test { | ||
ProxyAdmin proxyAdmin = ProxyAdmin(0x246ABeC8f8a542E892934232DB3Fd97A61E3193c); | ||
BoostedMasterChefJoe proxy = BoostedMasterChefJoe(0x4483f0b6e2F5486D06958C20f8C39A7aBe87bf8F); | ||
|
||
address ms = 0x2fbB61a10B96254900C03F1644E9e1d2f5E76DD2; | ||
|
||
function setUp() public { | ||
vm.createSelectFork(vm.rpcUrl("avalanche"), 37289196); | ||
} | ||
|
||
function test_Upgrade() public { | ||
uint256 previousTotalAllocPoint = proxy.totalAllocPoint(); | ||
|
||
vm.expectRevert("SafeMath: division by zero"); | ||
proxy.massUpdatePools(); | ||
|
||
vm.expectRevert("SafeMath: division by zero"); | ||
proxy.joePerSec(); | ||
|
||
address newImpl = address(new BoostedMasterChefJoe()); | ||
|
||
vm.prank(ms); | ||
proxyAdmin.upgrade(TransparentUpgradeableProxy(payable(address(proxy))), newImpl); | ||
|
||
assertEq(proxy.joePerSec(), 0); | ||
assertEq(proxy.totalAllocPoint(), previousTotalAllocPoint); | ||
|
||
proxy.massUpdatePools(); | ||
} | ||
} |