2023-05-16 21:59:25 +00:00
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
2023-06-21 14:20:23 +00:00
|
|
|
pragma solidity 0.8.19;
|
2023-05-16 21:59:25 +00:00
|
|
|
|
2023-05-23 22:10:37 +00:00
|
|
|
import "./StakeManager.sol";
|
2023-05-16 21:59:25 +00:00
|
|
|
|
2023-06-21 14:20:23 +00:00
|
|
|
/**
|
|
|
|
* @title StakeVault
|
|
|
|
* @author Ricardo Guilherme Schmidt <ricardo3@status.im>
|
|
|
|
* @notice Secures user stake
|
|
|
|
*/
|
2023-05-16 21:59:25 +00:00
|
|
|
contract StakeVault {
|
|
|
|
address owner;
|
2023-05-23 22:10:37 +00:00
|
|
|
StakeManager stakeManager;
|
2023-05-16 21:59:25 +00:00
|
|
|
|
|
|
|
ERC20 stakedToken;
|
|
|
|
|
|
|
|
|
2023-06-21 14:20:23 +00:00
|
|
|
constructor(address _owner) public {
|
|
|
|
owner = _owner;
|
2023-05-16 21:59:25 +00:00
|
|
|
}
|
|
|
|
|
2023-06-21 14:20:23 +00:00
|
|
|
function join(uint256 _amount, uint256 _time) external {
|
2023-05-24 13:25:52 +00:00
|
|
|
stakedToken.transferFrom(msg.sender, address(this), amount);
|
2023-06-21 14:20:23 +00:00
|
|
|
stakeManager.increaseBalance(amount, 0);
|
2023-05-24 13:25:52 +00:00
|
|
|
}
|
|
|
|
|
2023-06-21 14:20:23 +00:00
|
|
|
function leave(uint256 _amount) external {
|
|
|
|
stakeManager.decreaseBalance(amount);
|
|
|
|
stakedToken.transferFrom(address(this), msg.sender, amount);
|
2023-05-24 13:25:52 +00:00
|
|
|
}
|
2023-05-16 21:59:25 +00:00
|
|
|
|
|
|
|
}
|