mirror of https://github.com/logos-co/staking.git
Only vaults that Re previosly allowed
This commit is contained in:
parent
d960512915
commit
ff3a7b09ea
|
@ -4,7 +4,7 @@ pragma solidity 0.8.19;
|
||||||
|
|
||||||
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
||||||
|
|
||||||
contract StakeManager is ERC20 {
|
contract StakeManager is Controlled {
|
||||||
|
|
||||||
struct Account {
|
struct Account {
|
||||||
uint256 lockUntil;
|
uint256 lockUntil;
|
||||||
|
@ -27,12 +27,18 @@ contract StakeManager is ERC20 {
|
||||||
|
|
||||||
mapping (address => Account) accounts;
|
mapping (address => Account) accounts;
|
||||||
mapping (uint256 => Epoch) epoch;
|
mapping (uint256 => Epoch) epoch;
|
||||||
|
mapping (bytes32 => bool) isVault;
|
||||||
|
|
||||||
ERC20 stakedToken;
|
ERC20 stakedToken;
|
||||||
uint256 currentEpoch;
|
uint256 currentEpoch;
|
||||||
uint256 pendingReward;
|
uint256 pendingReward;
|
||||||
uint256 public totalSupply;
|
uint256 public totalSupply;
|
||||||
|
|
||||||
|
modifier onlyVault {
|
||||||
|
require(isVault[msg.sender.codehash], "Not a vault")
|
||||||
|
_;
|
||||||
|
}
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
epoch[0].startTime = now();
|
epoch[0].startTime = now();
|
||||||
}
|
}
|
||||||
|
@ -135,6 +141,14 @@ contract StakeManager is ERC20 {
|
||||||
pendingReward -= userReward;
|
pendingReward -= userReward;
|
||||||
stakedToken.transfer(_vault, userReward);
|
stakedToken.transfer(_vault, userReward);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notice Enables a contract class to interact with staking functions
|
||||||
|
* @param _codehash bytecode hash of contract
|
||||||
|
*/
|
||||||
|
function setVault(bytes32 _codehash) external onlyController {
|
||||||
|
isVault[_codehash] = true;
|
||||||
|
}
|
||||||
|
|
||||||
function checkMaxMultiplier(uint256 _increasedMultiplier, uint256 _currentMp) private view returns(uint256 _maxToIncrease) {
|
function checkMaxMultiplier(uint256 _increasedMultiplier, uint256 _currentMp) private view returns(uint256 _maxToIncrease) {
|
||||||
uint256 newMp = _increasedMultiplier + _currentMp;
|
uint256 newMp = _increasedMultiplier + _currentMp;
|
||||||
|
|
Loading…
Reference in New Issue