Skip to content
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

develop-acp99 #30

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open

develop-acp99 #30

wants to merge 22 commits into from

Conversation

zjesko
Copy link

@zjesko zjesko commented Feb 12, 2025

Why this should be merged

How this works

How this was tested

How is this documented

tushar994 and others added 8 commits February 14, 2025 23:14
* initilialiser checks and events

* add complete delegator removal if validator has ended

* add tests for double delegation and stake and nft delegation by same delegator

* fix tests and add nft event

* add locked nfts to event
* add validator removal admin

* nit: fix extra space
@zjesko zjesko changed the title develop-acp99 WIP develop-acp99 Feb 17, 2025
@zjesko zjesko marked this pull request as ready for review February 17, 2025 21:47
@zjesko zjesko force-pushed the develop-acp99 branch 2 times, most recently from 3f489d9 to 1c3128c Compare February 25, 2025 13:46
Comment on lines +716 to +731
function _calculateEffectiveWeight(
uint256 weight,
uint64 currentUptime,
uint64 previousUptime
) internal view returns (uint256) {
if(previousUptime > currentUptime || currentUptime == 0) {
return 0;
}

// Return full weight if uptime is above threshold
if((currentUptime - previousUptime) * 100 / _getStakingManagerStorage()._epochDuration > UPTIME_REWARDS_THRESHOLD_PERCENTAGE) {
return weight;
}
// Calculate effective weight based on both weight and time period
return (weight * (currentUptime - previousUptime)) / _getStakingManagerStorage()._epochDuration;
}

Check warning

Code scanning / Slither

Dangerous strict equalities Medium

Comment on lines +716 to +731
function _calculateEffectiveWeight(
uint256 weight,
uint64 currentUptime,
uint64 previousUptime
) internal view returns (uint256) {
if(previousUptime > currentUptime || currentUptime == 0) {
return 0;
}

// Return full weight if uptime is above threshold
if((currentUptime - previousUptime) * 100 / _getStakingManagerStorage()._epochDuration > UPTIME_REWARDS_THRESHOLD_PERCENTAGE) {
return weight;
}
// Calculate effective weight based on both weight and time period
return (weight * (currentUptime - previousUptime)) / _getStakingManagerStorage()._epochDuration;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants