-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add StakeVault and implements StakeManager interface into Rewar…
…dsStreamerMP This commit adds the following changes: - Add the contract `StakeVault` so funds can be stored safely by the user. #14 - Added the interface `ITrustedCodehashAccess` and contract `TrustedCodehashAccess` in the `src/access` directory, which implements the `ITrustedCodehashAccess` interface and provides functionality to set or update the trust status for a contract's codehash and implemented it on `RewardStreamerMP`. #15 - added the interface `IStakeManager` and implemented it on `RewardStreamerMP` #13 These changes are necessary to enforce security measures and restrict access based on the codehash of the caller, and allow for better reuse of code between StakeManager and RewardStreamerMP.
- Loading branch information
Showing
5 changed files
with
430 additions
and
52 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// 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 stake(uint256 _amount, uint256 _seconds) external; | ||
function unstake(uint256 _amount) external; | ||
function lock(uint256 _secondsIncrease) external; | ||
function leave() external returns (bool _leaveAccepted); | ||
function acceptUpdate() external returns (address _migrated); | ||
|
||
function potentialMP() external view returns (uint256); | ||
function totalMP() external view returns (uint256); | ||
function totalStaked() external view returns (uint256); | ||
function totalSupply() external view returns (uint256 _totalSupply); | ||
function totalSupplyMinted() external view returns (uint256 _totalSupply); | ||
function pendingReward() external view returns (uint256); | ||
function getStakedBalance(address _vault) external view returns (uint256 _balance); | ||
|
||
function STAKE_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_APY() external view returns (uint256); | ||
function MAX_BOOST() external view returns (uint256); | ||
|
||
function calculateMP(uint256 _balance, uint256 _deltaTime) public pure returns (uint256); | ||
} |
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
Oops, something went wrong.