Skip to content

Commit

Permalink
chore: placeholder upgrade tests
Browse files Browse the repository at this point in the history
  • Loading branch information
woodenfurniture committed Apr 11, 2024
1 parent e68ea9e commit 51d7580
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
2 changes: 2 additions & 0 deletions foundry/src/FoxStaking.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ contract FoxStaking is
OwnableUpgradeable
{
using SafeERC20 for IERC20;
uint256 public version;
IERC20 public foxToken;
mapping(address => StakingInfo) public stakingInfo;
bool public stakingPaused;
Expand Down Expand Up @@ -46,6 +47,7 @@ contract FoxStaking is
__Ownable_init(msg.sender);
__UUPSUpgradeable_init();
__Pausable_init();
version = 1;
foxToken = IERC20(foxTokenAddress);
stakingPaused = false;
withdrawalsPaused = false;
Expand Down
30 changes: 30 additions & 0 deletions foundry/test/FoxStakingTestUpgrades.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.25;

import "forge-std/Test.sol";
import "../src/FoxStaking.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {Pausable} from "@openzeppelin/contracts/utils/Pausable.sol";
import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol";
import {MockFOXToken} from "./MockFOXToken.sol";

contract FOXStakingTestUpgrades is Test {
FoxStaking public foxStaking;
MockFOXToken public foxToken;
address user = address(0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045);

function setUp() public {
foxToken = new MockFOXToken();
address foxStakingProxy = Upgrades.deployUUPSProxy(
"FoxStaking.sol",
abi.encodeCall(FoxStaking.initialize, (address(foxToken)))
);
foxStaking = FoxStaking(foxStakingProxy);
}

function testCanDeploy() public view {
uint256 expectedVersion = 1;
assertEq(foxStaking.version(), expectedVersion);
}
}
16 changes: 16 additions & 0 deletions foundry/test/MockFOXToken.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.25;

import "forge-std/Test.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract MockFOXToken is ERC20 {
constructor() ERC20("Mock FOX Token", "FOX") {
// 1M FOX for testing, only in local chain can't use this as voting power soz
_mint(address(this), 1e24);
}

function makeItRain(address to, uint256 amount) public {
_transfer(address(this), to, amount);
}
}

0 comments on commit 51d7580

Please sign in to comment.