remove obsolete files

This commit is contained in:
Ricardo Guilherme Schmidt 2023-06-23 10:02:24 -03:00
parent 14782c9dd2
commit 56bc1a5b05
No known key found for this signature in database
GPG Key ID: 3F95A3AD0B607030
4 changed files with 0 additions and 177 deletions

View File

@ -1,25 +0,0 @@
function getMaxMultiplierPoints() public view returns(uint256) {
return balance * (stakeManager.MAX_BOOST() + lockup + 1);
}
function mintMultiplierPoints() internal {
uint256 new_mp = multiplierPoints + (balance * stakeManager.MP_APY());
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;
}
}
}

View File

@ -1,79 +0,0 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract StakeManager is ERC20 {
ERC20 stakedToken;
uint256 public constant MP_APY = 1;
uint256 public constant STAKE_APY = 1;
uint256 public constant MAX_BOOST = 1;
uint256 public constant MAX_MP = 1;
mapping (address => Account) accounts;
struct Account {
uint256 lockTime;
uint256 balance;
uint256 multiplier;
uint256 multiplierUpdate;
}
mapping (address => Account) account;
function increaseBalance(uint256 _amount, uint256 _time) external {
accounts[msg.sender].balance += _amount;
uint256 mp = calcInitialMultiplierPoints(_amount, _time);
accounts[msg.sender].multiplier += mp;
multiplierSupply += mp;
accounts[msg.sender].update = now();
accounts[msg.sender].lockTime = now() + _time;
mint(msg.sender, _amount);
}
function decreaseBalance(uint256 _amount) external {
accounts[msg.sender].balance -= _amount;
accounts[msg.sender].multiplier -= calcInitialMultiplierPoints(_amount, 1);
burn(msg.sender, _amount);
}
function balanceLock(uint256 _time) external {
require(now() + _time > accounts[msg.sender].lockTime, "Cannot decrease lock time");
accounts[msg.sender].lockTime = now() + _time;
}
/**
* @dev Function called to increase the Multiplier Points of a Vault
* @param _vault
*/
function mintMultiplierPoints(address _vault) external {
uint256 dT = now() - accounts[msg.sender].update;
accounts[msg.sender].update = now();
uint256 mp = calcAccuredMultiplierPoints(accounts[_vault].balance, accounts[_vault].multiplier, dT);
multiplierSupply += mp;
accounts[_vault].multiplier += mp;
}
function calcInitialMultiplierPoints(uint256 _amount, uint256 _time) pure public returns(uint256) {
return _amount * (_time + 1);
}
function calcAccuredMultiplierPoints(uint256 _balance, uint256 _currentMp, uint256 _deltaTime) pure public returns(uint256) {
uint256 accured = _balance * (MP_APY * _deltaTime);
uint256 newMp = accured + _currentMp;
return newMp > MAX_MP ? MAX_MP - newMp : accurred;
}
function getRewardsEmissions() public view returns(uint256){
uint256 totalStaked = this.totalSupply;
uint256 share = this.multiplierSupply +totalSupply;
}
}

View File

@ -1,73 +0,0 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;
contract Staking {
uint256 stake;
uint256 max_boost;
uint256 lockup;
constructor() {
}
/// @notice Calculates the maximum multiplier points an account can have
function max_mp() public view returns(uint256){
return stake * (max_boost + lockup + 1);
}
/// @notice Create multiplier points for an account
function mint_mp() public {
/**
factor = params['NUM_PERIODS_IN_YEAR']
mp_apy = (params["MP_APY"]/100.)/factor
# prev_state already accounts for partial state updates,
# in case other policies were applied before this one.
staked_tokens = prev_state['staked_tokens']
mps = prev_state['staked_mps']
max_staked_mps = prev_state['max_staked_mps']
active = prev_state['active']
delta_mps = active * np.minimum(
staked_tokens * mp_apy, max_staked_mps - mps
)
*/
}
/// @notice Create initial multiplier points for locked stake
function inital_mp() public {
/**
return np.where(lockup>0, stake * (lockup + 1), 0.)
*/
}
/// @notice Distribute rewards
function distribute_rewards() public {
/**
factor = params['NUM_PERIODS_IN_YEAR']
stake_apy = (params['CUMULATIVE_STAKE_APY']/100.)/factor
# prev_state already accounts for partial state updates,
# in case other policies were applied before this one.
staked = prev_state['staked_tokens']
mps = prev_state['staked_mps']
rewards = prev_state['rewards_emissions']
active = prev_state['active']
if stake_apy > 0.:
delta_rewards_tokens = stake_apy * active * (staked + mps)
else:
cs = ((staked + mps) * active).sum()
if cs > 0.:
delta_rewards_tokens = rewards * active * (staked + mps) / cs
else:
delta_rewards_tokens = np.zeros_like(prev_state['staked_tokens'])
*/
}
}