-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Init ERC721 pool #17
Conversation
Merge latest updates from develop
… into feature/erc721lockupstakingpool
Develop merge into 721
This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation. |
function _getMultiplier( | ||
uint256 _from, | ||
uint256 _to | ||
) internal view returns (uint256) { | ||
if (_from > pool.endTime) { | ||
return 0; | ||
} | ||
if (_to <= pool.endTime) { | ||
return _to - _from; | ||
} else { | ||
return pool.endTime - _from; | ||
} | ||
} |
Check notice
Code scanning / Slither
Block timestamp Low
Dangerous comparisons:
- _from > pool.endTime
- _to <= pool.endTime
constructor( | ||
address stakeToken, | ||
address rewardToken, | ||
uint256 rewardTokenPerSecond, | ||
uint256 poolStartTime, | ||
uint256 poolEndTime, | ||
uint256 unstakeLockupTime, | ||
uint256 claimLockUpTime | ||
) Ownable(msg.sender) { | ||
// Ensure the staking period is valid | ||
if (poolStartTime > poolEndTime) revert InvalidStakingPeriod(); | ||
// Ensure the start time is in the future | ||
if (poolStartTime < block.timestamp) revert InvalidStartTime(); | ||
// Ensure the lockup periods are valid | ||
if (unstakeLockupTime > poolEndTime || claimLockUpTime > poolEndTime) | ||
revert InvalidLockupTime(); | ||
|
||
pool.stakeToken = IERC721(stakeToken); | ||
pool.rewardToken = IERC20(rewardToken); | ||
pool.startTime = poolStartTime; | ||
pool.endTime = poolEndTime; | ||
pool.unstakeLockupTime = unstakeLockupTime; | ||
pool.claimLockupTime = claimLockUpTime; | ||
pool.rewardTokenPerSecond = rewardTokenPerSecond; | ||
pool.lastUpdateTimestamp = block.timestamp; | ||
} |
Check notice
Code scanning / Slither
Block timestamp Low
Dangerous comparisons:
- poolStartTime < block.timestamp
function claim() external nonReentrant { | ||
// Check if the current timestamp is before the claim lockup time | ||
if (block.timestamp < pool.claimLockupTime) | ||
revert TokensInLockup(block.timestamp, pool.claimLockupTime); | ||
|
||
// Update the pool | ||
_updatePool(); | ||
|
||
// Get user information | ||
UserInfo storage user = userInfo[msg.sender]; | ||
uint256 amount = user.amount; | ||
uint256 pending = user.pending; | ||
|
||
// Calculate pending rewards | ||
if (amount > 0) { | ||
pending += (amount * pool.accRewardPerShare) - user.rewardDebt; | ||
user.rewardDebt = (user.amount * pool.accRewardPerShare); | ||
} | ||
if (pending == 0) revert NothingToClaim(); | ||
// Transfer pending rewards to the user | ||
user.pending = 0; | ||
unchecked { | ||
user.claimed += pending; | ||
} | ||
pool.totalClaimed += pending; | ||
pool.rewardToken.safeTransfer(msg.sender, pending); | ||
emit Claim(msg.sender, pending); | ||
} |
Check notice
Code scanning / Slither
Block timestamp Low
Dangerous comparisons:
- block.timestamp < pool.claimLockupTime
- pending > 0
…ages, code refactoring
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Slither found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
No description provided.