mirror of https://github.com/logos-co/staking.git
save progress
This commit is contained in:
parent
a692d32516
commit
254afe9932
|
@ -9,6 +9,10 @@ contract StakeManager is ERC20 {
|
|||
address stakedToken;
|
||||
|
||||
bytes32 vaultCodehash;
|
||||
uint256 mp_supply = 0;
|
||||
uint256 public constant MP_APY = 1;
|
||||
uint256 public constant STAKE_APY = 1;
|
||||
uint256 public constant MAX_BOOST = 1;
|
||||
|
||||
mapping (address => Account) account;
|
||||
|
||||
|
@ -18,7 +22,7 @@ contract StakeManager is ERC20 {
|
|||
}
|
||||
|
||||
function join(uint256 amount) external onlyVault {
|
||||
stakedToken.transferFrom(msg.sender, )
|
||||
|
||||
}
|
||||
|
||||
function lock(uint256 amount, uint256 time) external onlyVault {
|
||||
|
@ -33,6 +37,14 @@ contract StakeManager is ERC20 {
|
|||
|
||||
}
|
||||
|
||||
function getRewardsEmissions() public view returns(uint256){
|
||||
|
||||
}
|
||||
|
||||
|
||||
function increase_mp(uint256 amount) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -12,21 +12,21 @@ contract StakeVault {
|
|||
ERC20 stakedToken;
|
||||
uint256 balance;
|
||||
uint256 locked;
|
||||
uint256 unlockTime;
|
||||
uint256 lockedPeriod;
|
||||
uint256 multiplierPoints;
|
||||
|
||||
//uint256 constant FACTOR = 1;
|
||||
uint256 constant MP_APY = 1;
|
||||
uint256 constant MAX_MP = 1;
|
||||
|
||||
function join(uint256 amount) external {
|
||||
stakedToken.transferFrom(msg.sender, address(this), amount);
|
||||
_join(amount);
|
||||
}
|
||||
|
||||
function lock(uint256 amount, uint256 time) external {
|
||||
|
||||
_lock(amount,time);
|
||||
}
|
||||
|
||||
function joinAndLock(uint256 amount, uint256 time) external {
|
||||
_join(amount);
|
||||
_lock(amount,time);
|
||||
|
||||
}
|
||||
|
||||
|
@ -34,14 +34,41 @@ contract StakeVault {
|
|||
|
||||
}
|
||||
|
||||
function getMaxMultiplierPoints() public view returns(uint256) {
|
||||
return balance * (stakeManager.MAX_BOOST() + lockup + 1);
|
||||
}
|
||||
|
||||
function _join(uint256 amount) internal {
|
||||
stakedToken.transferFrom(msg.sender, address(this), amount);
|
||||
}
|
||||
|
||||
function _lock(uint256 amount, uint256 time) internal {
|
||||
require(time > 0, "Invalid lock time");
|
||||
lockedPeriod = time;
|
||||
unlockTime = now() + time;
|
||||
locked = amount;
|
||||
multiplierPoints += amount * (time + 1);
|
||||
}
|
||||
|
||||
function mintMultiplierPoints() internal {
|
||||
uint256 new_mp = multiplierPoints + (balance * stakeManager.MP_APY());
|
||||
uint256 max_mp = stakeManager.MAX_MP();
|
||||
uint256 max_mp = getMaxMultiplierPoints();
|
||||
multiplierPoints = new_mp > max_mp ? max_mp : new_mp;
|
||||
}
|
||||
|
||||
function distriuteRewards() internal {
|
||||
uitn256 stakeApy = stakeManager.STAKE_APY()
|
||||
|
||||
if(stakeApy > 0){
|
||||
return stake_apy * (balance + multiplierPoints)
|
||||
} else {
|
||||
uint256 cs = balance + multiplierPoints
|
||||
uint256 rewards = stakeManager.getRewardEmissions();
|
||||
if(cs > 0){
|
||||
return = rewards * (balance + multiplierPoints) / cs
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue