add documentation

This commit is contained in:
Ricardo Guilherme Schmidt 2023-06-23 13:47:37 -03:00
parent e217f9b78e
commit d960512915
No known key found for this signature in database
GPG Key ID: 3F95A3AD0B607030
1 changed files with 20 additions and 8 deletions

View File

@ -32,15 +32,16 @@ contract StakeManager is ERC20 {
uint256 currentEpoch; uint256 currentEpoch;
uint256 pendingReward; uint256 pendingReward;
uint256 public totalSupply; uint256 public totalSupply;
constructor() { constructor() {
epoch[0].startTime = now(); epoch[0].startTime = now();
} }
/**
* Increases balance of msg.sender;
* @param _amount Amount of balance to be decreased.
* @param _time Seconds from now() to lock balance.
*/
function increaseBalance(uint256 _amount, uint256 _time) external { function increaseBalance(uint256 _amount, uint256 _time) external {
Account storage account = accounts[msg.sender]; Account storage account = accounts[msg.sender];
uint256 increasedMultiplier = _amount * (_time + 1); uint256 increasedMultiplier = _amount * (_time + 1);
@ -53,7 +54,10 @@ contract StakeManager is ERC20 {
totalSupply += _amount; totalSupply += _amount;
} }
/**
* Decreases balance of msg.sender;
* @param _amount Amount of balance to be decreased
*/
function decreaseBalance(uint256 _amount) external { function decreaseBalance(uint256 _amount) external {
Account storage account = accounts[msg.sender]; Account storage account = accounts[msg.sender];
uint256 reducedMultiplier = (_amount * account.multiplier) / account.balance; uint256 reducedMultiplier = (_amount * account.multiplier) / account.balance;
@ -65,7 +69,7 @@ contract StakeManager is ERC20 {
} }
/** /**
* Locks entire balance for more amount of time. * @notice Locks entire balance for more amount of time.
* @param _time amount of time to lock from now. * @param _time amount of time to lock from now.
*/ */
function balanceLock(uint256 _time) external { function balanceLock(uint256 _time) external {
@ -82,8 +86,8 @@ contract StakeManager is ERC20 {
} }
/** /**
* @dev Function called to increase the Multiplier Points of a Vault * @notice Increase the multiplier points of an account
* @param _vault * @param _vault Referring account
*/ */
function mintMultiplierPoints(address _vault) external { function mintMultiplierPoints(address _vault) external {
Account storage account = accounts[msg.sender]; Account storage account = accounts[msg.sender];
@ -96,6 +100,9 @@ contract StakeManager is ERC20 {
multiplierSupply += increasedMultiplier; multiplierSupply += increasedMultiplier;
} }
/**
* @notice Release rewards for current epoch and increase epoch.
*/
function executeEpochReward() external { function executeEpochReward() external {
if(now() > epoch[currentEpoch].startTime + EPOCH_SIZE){ if(now() > epoch[currentEpoch].startTime + EPOCH_SIZE){
uint256 epochReward = stakedToken.balanceOf(this) - pendingReward; uint256 epochReward = stakedToken.balanceOf(this) - pendingReward;
@ -107,6 +114,11 @@ contract StakeManager is ERC20 {
} }
/**
* @notice Execute rewards for account until limit has reached
* @param _vault Referred account
* @param _limit Until what epoch it should be executed
*/
function executeUserReward(address _vault, uint256 _limitEpoch) external { function executeUserReward(address _vault, uint256 _limitEpoch) external {
Account storage account = accounts[msg.sender]; Account storage account = accounts[msg.sender];
uint256 userReward; uint256 userReward;