mirror of https://github.com/logos-co/staking.git
Update specs and interface
This commit is contained in:
parent
5d576825a3
commit
4669a4fcf3
127
.gas-report
127
.gas-report
|
@ -1,127 +0,0 @@
|
|||
| contracts/StakeManager.sol:StakeManager contract | | | | | |
|
||||
|--------------------------------------------------|-----------------|--------|--------|--------|---------|
|
||||
| Deployment Cost | Deployment Size | | | | |
|
||||
| 2512529 | 13257 | | | | |
|
||||
| Function Name | min | avg | median | max | # calls |
|
||||
| EPOCH_SIZE | 285 | 285 | 285 | 285 | 1498 |
|
||||
| MAX_LOCKUP_PERIOD | 361 | 361 | 361 | 361 | 4 |
|
||||
| MAX_MULTIPLIER | 307 | 307 | 307 | 307 | 637 |
|
||||
| MIN_LOCKUP_PERIOD | 264 | 264 | 264 | 264 | 12 |
|
||||
| YEAR | 307 | 307 | 307 | 307 | 637 |
|
||||
| acceptUpdate | 23632 | 23632 | 23632 | 23632 | 1 |
|
||||
| accounts | 1572 | 1572 | 1572 | 1572 | 144273 |
|
||||
| calculateMP | 738 | 738 | 738 | 738 | 1276 |
|
||||
| currentEpoch | 406 | 1072 | 406 | 2406 | 54 |
|
||||
| epochEnd | 627 | 627 | 627 | 2627 | 23675 |
|
||||
| epochReward | 1381 | 2881 | 1381 | 5881 | 3 |
|
||||
| executeAccount(address) | 149349 | 149349 | 149349 | 149349 | 2 |
|
||||
| executeAccount(address,uint256) | 26540 | 72264 | 74140 | 200389 | 141860 |
|
||||
| executeEpoch() | 23458 | 120684 | 121843 | 900358 | 23564 |
|
||||
| executeEpoch(uint256) | 23905 | 24541 | 23905 | 26134 | 7 |
|
||||
| expiredStakeStorage | 394 | 2303 | 2394 | 2394 | 22 |
|
||||
| isTrustedCodehash | 541 | 949 | 541 | 2541 | 680 |
|
||||
| leave | 23631 | 23631 | 23631 | 23631 | 1 |
|
||||
| lock | 23862 | 23862 | 23862 | 23862 | 1 |
|
||||
| migration | 417 | 1417 | 1417 | 2417 | 4 |
|
||||
| migrationInitialize | 24624 | 24624 | 24624 | 24624 | 1 |
|
||||
| newEpoch | 441 | 441 | 441 | 441 | 5 |
|
||||
| owner | 2410 | 2410 | 2410 | 2410 | 13 |
|
||||
| pendingReward | 408 | 1442 | 2408 | 2408 | 29 |
|
||||
| potentialMP | 408 | 408 | 408 | 408 | 46432 |
|
||||
| previousManager | 275 | 275 | 275 | 275 | 13 |
|
||||
| rewardToken | 293 | 293 | 293 | 293 | 696 |
|
||||
| setTrustedCodehash | 47960 | 47960 | 47960 | 47960 | 139 |
|
||||
| stake | 24005 | 24005 | 24005 | 24005 | 1 |
|
||||
| startMigration | 103624 | 103632 | 103636 | 103636 | 3 |
|
||||
| startTime | 264 | 264 | 264 | 264 | 21 |
|
||||
| totalMP | 385 | 385 | 385 | 2385 | 46453 |
|
||||
| totalStaked | 385 | 1785 | 2385 | 2385 | 20 |
|
||||
| totalSupply | 784 | 1965 | 2784 | 2784 | 22 |
|
||||
| unstake | 23841 | 23841 | 23841 | 23841 | 1 |
|
||||
|
||||
|
||||
| contracts/StakeVault.sol:StakeVault contract | | | | | |
|
||||
|----------------------------------------------|-----------------|--------|--------|--------|---------|
|
||||
| Deployment Cost | Deployment Size | | | | |
|
||||
| 0 | 0 | | | | |
|
||||
| Function Name | min | avg | median | max | # calls |
|
||||
| acceptMigration | 35140 | 35140 | 35140 | 35140 | 2 |
|
||||
| leave | 35152 | 35152 | 35152 | 35152 | 1 |
|
||||
| lock | 43329 | 90544 | 61982 | 180383 | 7 |
|
||||
| owner | 351 | 351 | 351 | 351 | 679 |
|
||||
| stake | 27265 | 282111 | 265792 | 351743 | 684 |
|
||||
| stakedToken | 215 | 215 | 215 | 215 | 2 |
|
||||
| unstake | 40157 | 96345 | 78682 | 229644 | 11 |
|
||||
|
||||
|
||||
| contracts/VaultFactory.sol:VaultFactory contract | | | | | |
|
||||
|--------------------------------------------------|-----------------|--------|--------|--------|---------|
|
||||
| Deployment Cost | Deployment Size | | | | |
|
||||
| 0 | 0 | | | | |
|
||||
| Function Name | min | avg | median | max | # calls |
|
||||
| createVault | 682103 | 682103 | 682103 | 682103 | 683 |
|
||||
| setStakeManager | 23710 | 26669 | 26076 | 30222 | 3 |
|
||||
| stakeManager | 368 | 1868 | 2368 | 2368 | 4 |
|
||||
|
||||
|
||||
| contracts/storage/ExpiredStakeStorage.sol:ExpiredStakeStorage contract | | | | | |
|
||||
|------------------------------------------------------------------------|-----------------|-------|--------|-------|---------|
|
||||
| Deployment Cost | Deployment Size | | | | |
|
||||
| 0 | 0 | | | | |
|
||||
| Function Name | min | avg | median | max | # calls |
|
||||
| getExpiredMP | 2427 | 2427 | 2427 | 2427 | 23725 |
|
||||
| transferOwnership | 28533 | 28533 | 28533 | 28533 | 1 |
|
||||
|
||||
|
||||
| lib/openzeppelin-contracts/contracts/token/ERC20/ERC20.sol:ERC20 contract | | | | | |
|
||||
|---------------------------------------------------------------------------|-----------------|-------|--------|-------|---------|
|
||||
| Deployment Cost | Deployment Size | | | | |
|
||||
| 0 | 0 | | | | |
|
||||
| Function Name | min | avg | median | max | # calls |
|
||||
| approve | 46175 | 46241 | 46199 | 46367 | 679 |
|
||||
| balanceOf | 561 | 2107 | 2561 | 2561 | 30744 |
|
||||
|
||||
|
||||
| script/Deploy.s.sol:Deploy contract | | | | | |
|
||||
|-------------------------------------|-----------------|---------|---------|---------|---------|
|
||||
| Deployment Cost | Deployment Size | | | | |
|
||||
| 6149710 | 29676 | | | | |
|
||||
| Function Name | min | avg | median | max | # calls |
|
||||
| run | 5343984 | 5343984 | 5343984 | 5343984 | 66 |
|
||||
|
||||
|
||||
| script/DeployMigrationStakeManager.s.sol:DeployMigrationStakeManager contract | | | | | |
|
||||
|-------------------------------------------------------------------------------|-----------------|---------|---------|---------|---------|
|
||||
| Deployment Cost | Deployment Size | | | | |
|
||||
| 3329385 | 16522 | | | | |
|
||||
| Function Name | min | avg | median | max | # calls |
|
||||
| run | 2345854 | 2345854 | 2345854 | 2345854 | 19 |
|
||||
|
||||
|
||||
| script/DeploymentConfig.s.sol:DeploymentConfig contract | | | | | |
|
||||
|---------------------------------------------------------|-----------------|-----|--------|-----|---------|
|
||||
| Deployment Cost | Deployment Size | | | | |
|
||||
| 0 | 0 | | | | |
|
||||
| Function Name | min | avg | median | max | # calls |
|
||||
| activeNetworkConfig | 455 | 455 | 455 | 455 | 132 |
|
||||
|
||||
|
||||
| test/mocks/BrokenERC20.s.sol:BrokenERC20 contract | | | | | |
|
||||
|---------------------------------------------------|-----------------|-------|--------|-------|---------|
|
||||
| Deployment Cost | Deployment Size | | | | |
|
||||
| 0 | 0 | | | | |
|
||||
| Function Name | min | avg | median | max | # calls |
|
||||
| approve | 46175 | 46175 | 46175 | 46175 | 1 |
|
||||
| balanceOf | 561 | 1227 | 561 | 2561 | 3 |
|
||||
|
||||
|
||||
| test/script/DeployBroken.s.sol:DeployBroken contract | | | | | |
|
||||
|------------------------------------------------------|-----------------|---------|---------|---------|---------|
|
||||
| Deployment Cost | Deployment Size | | | | |
|
||||
| 4834448 | 23474 | | | | |
|
||||
| Function Name | min | avg | median | max | # calls |
|
||||
| run | 4183805 | 4183805 | 4183805 | 4183805 | 1 |
|
||||
|
||||
|
||||
|
||||
|
|
@ -140,7 +140,7 @@ jobs:
|
|||
|
||||
- name: Install Solidity
|
||||
run: |
|
||||
wget https://github.com/ethereum/solidity/releases/download/v0.8.19/solc-static-linux
|
||||
wget https://github.com/ethereum/solidity/releases/download/v0.8.26/solc-static-linux
|
||||
chmod +x solc-static-linux
|
||||
sudo mv solc-static-linux /usr/local/bin/solc
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"extends": "solhint:recommended",
|
||||
"rules": {
|
||||
"code-complexity": ["error", 8],
|
||||
"compiler-version": ["error", ">=0.8.19"],
|
||||
"compiler-version": ["error", ">=0.8.27"],
|
||||
"func-name-mixedcase": "off",
|
||||
"func-visibility": ["error", { "ignoreConstructors": true }],
|
||||
"max-line-length": ["error", 120],
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
],
|
||||
"global_timeout": "7200",
|
||||
"link": [
|
||||
"StakeManager:stakedToken=ERC20A",
|
||||
"StakeManager:STAKING_TOKEN=ERC20A",
|
||||
"StakeManager:expiredStakeStorage=ExpiredStakeStorageA",
|
||||
],
|
||||
"loop_iter": "3",
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"certora/helpers/ERC20A.sol"
|
||||
],
|
||||
"link" : [
|
||||
"StakeManager:rewardToken=ERC20A",
|
||||
"StakeManager:REWARD_TOKEN=ERC20A",
|
||||
"StakeManager:expiredStakeStorage=ExpiredStakeStorageA"
|
||||
],
|
||||
"msg": "Verifying StakeManager.sol",
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"certora/helpers/ExpiredStakeStorageA.sol"
|
||||
],
|
||||
"link" : [
|
||||
"StakeManager:rewardToken=ERC20A",
|
||||
"StakeManager:REWARD_TOKEN=ERC20A",
|
||||
"StakeManager:expiredStakeStorage=ExpiredStakeStorageA"
|
||||
],
|
||||
"msg": "Verifying StakeManager ProcessAccount",
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"certora/helpers/ERC20A.sol"
|
||||
],
|
||||
"link" : [
|
||||
"StakeManager:rewardToken=ERC20A",
|
||||
"StakeManager:REWARD_TOKEN=ERC20A",
|
||||
"StakeManager:expiredStakeStorage=ExpiredStakeStorageA",
|
||||
],
|
||||
"msg": "Verifying StakeManager.sol",
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
],
|
||||
"link" : [
|
||||
"StakeVault:STAKED_TOKEN=ERC20A",
|
||||
"StakeManager:rewardToken=ERC20A",
|
||||
"StakeManager:REWARD_TOKEN=ERC20A",
|
||||
"StakeManager:expiredStakeStorage=ExpiredStakeStorageA",
|
||||
"StakeVault:stakeManager=StakeManager"
|
||||
],
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pragma solidity ^0.8.19;
|
||||
pragma solidity ^0.8.26;
|
||||
|
||||
import {StakeManager} from "../../contracts/StakeManager.sol";
|
||||
import { StakeManager } from "../../contracts/StakeManager.sol";
|
||||
|
||||
contract StakeManagerNew is StakeManager {
|
||||
constructor(address token, address oldManager) StakeManager(token, oldManager) {}
|
||||
constructor(address token, address oldManager) StakeManager(token, oldManager) { }
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pragma solidity ^0.8.19;
|
||||
pragma solidity ^0.8.26;
|
||||
|
||||
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
||||
|
||||
contract ERC20A is ERC20 {
|
||||
constructor(string memory name_, string memory symbol_) ERC20(name_, symbol_) {}
|
||||
constructor(string memory name_, string memory symbol_) ERC20(name_, symbol_) { }
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pragma solidity ^0.8.19;
|
||||
pragma solidity ^0.8.26;
|
||||
|
||||
import { ExpiredStakeStorage } from "./../../contracts/storage/ExpiredStakeStorage.sol";
|
||||
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.18;
|
||||
|
||||
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
||||
import { ITrustedCodehashAccess } from "./access/ITrustedCodehashAccess.sol";
|
||||
|
||||
interface IStakeManager is ITrustedCodehashAccess {
|
||||
error StakeManager__FundsLocked();
|
||||
error StakeManager__InvalidLockTime();
|
||||
error StakeManager__InsufficientFunds();
|
||||
error StakeManager__StakeIsTooLow();
|
||||
|
||||
function MIN_LOCKUP_PERIOD() external pure returns (uint256);
|
||||
function MAX_LOCKUP_PERIOD() external pure returns (uint256);
|
||||
|
||||
function stake(uint256 _amount, uint256 _seconds) external;
|
||||
function unstake(uint256 _amount) external;
|
||||
function lock(uint256 _secondsIncrease) external;
|
||||
|
||||
function acceptUpdate() external returns (IStakeManager _migrated);
|
||||
function leave() external returns (bool _leaveAccepted);
|
||||
|
||||
function totalStaked() external view returns (uint256 _totalStaked);
|
||||
function getStakedBalance(address _vault) external view returns (uint256 _balance);
|
||||
function potentialMP() external view returns (uint256 _potentialMP);
|
||||
function totalMP() external view returns (uint256 _totalMP);
|
||||
|
||||
function totalSupply() external view returns (uint256 _totalSupply);
|
||||
function totalSupplyMinted() external view returns (uint256 _totalSupply);
|
||||
function pendingReward() external view returns (uint256 _pendingReward);
|
||||
|
||||
function calculateMP(uint256 _balance, uint256 _deltaTime) external pure returns (uint256);
|
||||
}
|
|
@ -1,10 +1,11 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pragma solidity ^0.8.18;
|
||||
pragma solidity ^0.8.26;
|
||||
|
||||
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
|
||||
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
||||
import { IStakeManager } from "./IStakeManager.sol";
|
||||
import { StakeManager } from "./StakeManager.sol";
|
||||
|
||||
/**
|
||||
* @title StakeVault
|
||||
|
@ -20,18 +21,18 @@ contract StakeVault is Ownable {
|
|||
|
||||
IStakeManager private stakeManager;
|
||||
|
||||
IERC20 public immutable stakedToken;
|
||||
IERC20 public immutable STAKING_TOKEN;
|
||||
|
||||
event Staked(address from, address to, uint256 _amount, uint256 time);
|
||||
|
||||
constructor(address _owner, IERC20 _stakedToken, IStakeManager _stakeManager) {
|
||||
constructor(address _owner, IERC20 _STAKING_TOKEN, IStakeManager _stakeManager) {
|
||||
_transferOwnership(_owner);
|
||||
stakedToken = _stakedToken;
|
||||
STAKING_TOKEN = _STAKING_TOKEN;
|
||||
stakeManager = _stakeManager;
|
||||
}
|
||||
|
||||
function stake(uint256 _amount, uint256 _time) external onlyOwner {
|
||||
bool success = stakedToken.transferFrom(msg.sender, address(this), _amount);
|
||||
bool success = STAKING_TOKEN.transferFrom(msg.sender, address(this), _amount);
|
||||
if (!success) {
|
||||
revert StakeVault__StakingFailed();
|
||||
}
|
||||
|
@ -46,15 +47,15 @@ contract StakeVault is Ownable {
|
|||
|
||||
function unstake(uint256 _amount) external onlyOwner {
|
||||
stakeManager.unstake(_amount);
|
||||
bool success = stakedToken.transfer(msg.sender, _amount);
|
||||
bool success = STAKING_TOKEN.transfer(msg.sender, _amount);
|
||||
if (!success) {
|
||||
revert StakeVault__UnstakingFailed();
|
||||
}
|
||||
}
|
||||
|
||||
function leave() external onlyOwner {
|
||||
if (stakeManager.leave()) {
|
||||
stakedToken.transferFrom(address(this), msg.sender, stakedToken.balanceOf(address(this)));
|
||||
if (StakeManager(stakeManager).leave()) {
|
||||
STAKING_TOKEN.transferFrom(address(this), msg.sender, STAKING_TOKEN.balanceOf(address(this)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +63,7 @@ contract StakeVault is Ownable {
|
|||
* @notice Opt-in migration to a new IStakeManager contract.
|
||||
*/
|
||||
function acceptMigration() external onlyOwner {
|
||||
IStakeManager migrated = stakeManager.acceptUpdate();
|
||||
IStakeManager migrated = StakeManager(stakeManager).acceptUpdate();
|
||||
if (address(migrated) == address(0)) revert StakeVault__MigrationNotAvailable();
|
||||
stakeManager = migrated;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
|
||||
pragma solidity ^0.8.18;
|
||||
pragma solidity ^0.8.26;
|
||||
|
||||
import { Ownable2Step } from "@openzeppelin/contracts/access/Ownable2Step.sol";
|
||||
import { StakeManager } from "./StakeManager.sol";
|
||||
|
@ -57,7 +57,7 @@ contract VaultFactory is Ownable2Step {
|
|||
/// @dev Anyone can call this function.
|
||||
/// @dev Emits a {VaultCreated} event.
|
||||
function createVault() external returns (StakeVault) {
|
||||
StakeVault vault = new StakeVault(msg.sender, stakeManager.rewardToken(), stakeManager);
|
||||
StakeVault vault = new StakeVault(msg.sender, stakeManager.REWARD_TOKEN(), stakeManager);
|
||||
emit VaultCreated(address(vault), msg.sender);
|
||||
return vault;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.18;
|
||||
pragma solidity ^0.8.26;
|
||||
|
||||
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
|
||||
import { ITrustedCodehashAccess } from "./ITrustedCodehashAccess.sol";
|
||||
import { ITrustedCodehashAccess } from "../interfaces/ITrustedCodehashAccess.sol";
|
||||
|
||||
/**
|
||||
* @title TrustedCodehashAccess
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
// SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
pragma solidity ^0.8.26;
|
||||
|
||||
/**
|
||||
* @title Singleton Factory (EIP-2470)
|
||||
* @notice Exposes CREATE2 (EIP-1014) to deploy bytecode on deterministic addresses based on initialization code and
|
||||
* salt.
|
||||
* @author Ricardo Guilherme Schmidt (Status Research & Development GmbH)
|
||||
*/
|
||||
library AddressLib {
|
||||
error ERC2470__CREATE2Failed();
|
||||
error ERC2470__CREATE2BadCall();
|
||||
|
||||
function deploy(bytes memory _initCode, bytes32 _salt) internal returns (address payable createdContract) {
|
||||
assembly {
|
||||
createdContract := create2(callvalue(), add(_initCode, 0x20), mload(_initCode), _salt)
|
||||
}
|
||||
if (createdContract == address(0)) {
|
||||
revert ERC2470__CREATE2Failed();
|
||||
}
|
||||
}
|
||||
|
||||
function computeAddress(bytes memory, bytes32 _salt) public view returns (address payable) {
|
||||
return payable(hashToAddress(abi.encodePacked(bytes1(0xff), address(this), _salt, _initCode)));
|
||||
}
|
||||
|
||||
function computeAddress(address _deployer, bytes32 _salt, bytes memory _initCode) public pure returns (address) {
|
||||
return hashToAddress(abi.encodePacked(bytes1(0xff), _deployer, _salt, _initCode));
|
||||
}
|
||||
|
||||
function hashToAddress(bytes memory b) private pure returns (address addr) {
|
||||
return address(uint160(uint256(keccak256(b))));
|
||||
}
|
||||
|
||||
function addressToBytes(address a) internal pure returns (bytes memory) {
|
||||
return abi.encodePacked(a);
|
||||
}
|
||||
|
||||
function bytesToAddress(bytes memory b) external pure returns (address addr) {
|
||||
return abi.decode(b, (address));
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
pragma solidity ^0.8.18;
|
||||
pragma solidity ^0.8.26;
|
||||
|
||||
/**
|
||||
* @title Singleton Factory (EIP-2470)
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.26;
|
||||
|
||||
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
||||
import { ITrustedCodehashAccess } from "./ITrustedCodehashAccess.sol";
|
||||
|
||||
interface IStakeManager is ITrustedCodehashAccess {
|
||||
error StakeManager__FundsLocked();
|
||||
error StakeManager__InvalidLockTime();
|
||||
error StakeManager__InsufficientFunds();
|
||||
error StakeManager__StakeIsTooLow();
|
||||
|
||||
function stake(uint256 _amount, uint256 _seconds) external;
|
||||
function lock(uint256 _seconds) external;
|
||||
function unstake(uint256 _amount) external;
|
||||
|
||||
function totalStaked() external view returns (uint256);
|
||||
function totalMP() external view returns (uint256);
|
||||
function totalMaxMP() external view returns (uint256);
|
||||
function getStakedBalance(address _vault) external view returns (uint256 _balance);
|
||||
|
||||
function STAKING_TOKEN() external view returns (IERC20);
|
||||
function REWARD_TOKEN() external view returns (IERC20);
|
||||
function MIN_LOCKUP_PERIOD() external view returns (uint256);
|
||||
function MAX_LOCKUP_PERIOD() external view returns (uint256);
|
||||
function MP_RATE_PER_YEAR() external view returns (uint256);
|
||||
function MAX_MULTIPLIER() external view returns (uint256);
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.18;
|
||||
pragma solidity ^0.8.26;
|
||||
|
||||
/**
|
||||
* @title TrustedCodehashAccess
|
|
@ -1,5 +1,5 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.18;
|
||||
pragma solidity ^0.8.26;
|
||||
|
||||
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
optimizer_runs = 10_000
|
||||
out = "out"
|
||||
script = "script"
|
||||
solc = "0.8.20"
|
||||
solc = "0.8.26"
|
||||
src = "contracts"
|
||||
test = "test"
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity >=0.8.19 <=0.9.0;
|
||||
pragma solidity >=0.8.26 <=0.9.0;
|
||||
|
||||
import { Script } from "forge-std/Script.sol";
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// SPDX-License-Identifier: UNLICENSED
|
||||
pragma solidity >=0.8.19 <=0.9.0;
|
||||
pragma solidity >=0.8.26 <=0.9.0;
|
||||
|
||||
import { BaseScript } from "./Base.s.sol";
|
||||
import { DeploymentConfig } from "./DeploymentConfig.s.sol";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// SPDX-License-Identifier: UNLICENSED
|
||||
pragma solidity >=0.8.19 <=0.9.0;
|
||||
pragma solidity >=0.8.26 <=0.9.0;
|
||||
|
||||
import { BaseScript } from "./Base.s.sol";
|
||||
import { StakeManager } from "../contracts/StakeManager.sol";
|
||||
|
@ -18,7 +18,7 @@ contract DeployMigrationStakeManager is BaseScript {
|
|||
|
||||
function run() public returns (StakeManager) {
|
||||
prevStakeManager = vm.envOr({ name: "PREV_STAKE_MANAGER", defaultValue: prevStakeManager });
|
||||
stakeToken = vm.envOr({ name: "STAKE_TOKEN_ADDRESS", defaultValue: stakeToken });
|
||||
stakeToken = vm.envOr({ name: "STAKING_TOKEN_ADDRESS", defaultValue: stakeToken });
|
||||
|
||||
if (stakeToken == address(0)) {
|
||||
revert DeployMigrationStakeManager_InvalidStakeTokenAddress();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//// SPDX-License-Identifier: UNLICENSED
|
||||
|
||||
pragma solidity >=0.8.19 <=0.9.0;
|
||||
pragma solidity >=0.8.26 <=0.9.0;
|
||||
|
||||
import { Script } from "forge-std/Script.sol";
|
||||
import { MockERC20 } from "../test/mocks/MockERC20.sol";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// SPDX-License-Identifier: CC0-1.0
|
||||
pragma solidity ^0.8.19;
|
||||
pragma solidity ^0.8.26;
|
||||
|
||||
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// SPDX-License-Identifier: UNLICENSED
|
||||
pragma solidity ^0.8.19;
|
||||
pragma solidity ^0.8.26;
|
||||
|
||||
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
||||
|
||||
|
@ -35,7 +35,7 @@ contract StakeManagerTest is Test {
|
|||
assertEq(stakeManager.pendingReward(), 0);
|
||||
assertEq(stakeManager.totalMP(), 0);
|
||||
assertEq(stakeManager.totalStaked(), 0);
|
||||
assertEq(address(stakeManager.rewardToken()), stakeToken);
|
||||
assertEq(address(stakeManager.REWARD_TOKEN()), stakeToken);
|
||||
assertEq(address(stakeManager.previousManager()), address(0));
|
||||
assertEq(stakeManager.totalSupply(), 0);
|
||||
}
|
||||
|
@ -770,7 +770,7 @@ contract MigrationStakeManagerTest is StakeManagerTest {
|
|||
assertEq(newStakeManager.pendingReward(), 0);
|
||||
assertEq(newStakeManager.totalMP(), 0);
|
||||
assertEq(newStakeManager.totalStaked(), 0);
|
||||
assertEq(address(newStakeManager.rewardToken()), stakeToken);
|
||||
assertEq(address(newStakeManager.REWARD_TOKEN()), stakeToken);
|
||||
assertEq(address(newStakeManager.previousManager()), address(stakeManager));
|
||||
assertEq(newStakeManager.totalSupply(), 0);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// SPDX-License-Identifier: UNLICENSED
|
||||
pragma solidity ^0.8.19;
|
||||
pragma solidity ^0.8.26;
|
||||
|
||||
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
||||
|
||||
|
@ -42,7 +42,7 @@ contract StakedTokenTest is StakeVaultTest {
|
|||
}
|
||||
|
||||
function testStakeToken() public {
|
||||
assertEq(address(stakeVault.stakedToken()), stakeToken);
|
||||
assertEq(address(stakeVault.STAKING_TOKEN()), stakeToken);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// SPDX-License-Identifier: UNLICENSED
|
||||
pragma solidity ^0.8.19;
|
||||
pragma solidity ^0.8.26;
|
||||
|
||||
import { Test } from "forge-std/Test.sol";
|
||||
import { Deploy } from "../script/Deploy.s.sol";
|
||||
|
@ -18,14 +18,14 @@ contract VaultFactoryTest is Test {
|
|||
|
||||
address internal deployer;
|
||||
|
||||
address internal stakedToken;
|
||||
address internal STAKING_TOKEN;
|
||||
|
||||
address internal testUser = makeAddr("testUser");
|
||||
|
||||
function setUp() public virtual {
|
||||
Deploy deployment = new Deploy();
|
||||
(vaultFactory, stakeManager, deploymentConfig) = deployment.run();
|
||||
(deployer, stakedToken) = deploymentConfig.activeNetworkConfig();
|
||||
(deployer, STAKING_TOKEN) = deploymentConfig.activeNetworkConfig();
|
||||
}
|
||||
|
||||
function testDeployment() public {
|
||||
|
@ -67,6 +67,6 @@ contract CreateVaultTest is VaultFactoryTest {
|
|||
emit VaultCreated(makeAddr("some address"), testUser);
|
||||
StakeVault vault = vaultFactory.createVault();
|
||||
assertEq(vault.owner(), testUser);
|
||||
assertEq(address(vault.stakedToken()), address(stakedToken));
|
||||
assertEq(address(vault.STAKING_TOKEN()), address(STAKING_TOKEN));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// SPDX-License-Identifier: UNLICENSED
|
||||
pragma solidity ^0.8.19;
|
||||
pragma solidity ^0.8.26;
|
||||
|
||||
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// SPDX-License-Identifier: UNLICENSED
|
||||
pragma solidity ^0.8.19;
|
||||
pragma solidity ^0.8.26;
|
||||
|
||||
import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// SPDX-License-Identifier: UNLICENSED
|
||||
pragma solidity ^0.8.19;
|
||||
pragma solidity ^0.8.26;
|
||||
|
||||
import { BaseScript } from "../../script/Base.s.sol";
|
||||
import { StakeManager } from "../../contracts/StakeManager.sol";
|
||||
|
|
Loading…
Reference in New Issue