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

Fix bribing accounting by converting lqty to votes #13

Closed
wants to merge 7 commits into from

Conversation

jltqy
Copy link
Collaborator

@jltqy jltqy commented Oct 8, 2024

No description provided.

@GalloDaSballo
Copy link
Collaborator

You can further simplify the logic of onAfterAllocateLQTY

By writing the following:

function onAfterAllocateLQTY(
        uint16 _currentEpoch,
        address _user,
        IGovernance.UserState calldata _userState,
        IGovernance.Allocation calldata _allocation,
        IGovernance.InitiativeState calldata _initiativeState
    ) external virtual onlyGovernance {

        if (_currentEpoch == 0) return;

        uint16 mostRecentUserEpoch = lqtyAllocationByUserAtEpoch[_user].getHead();
        uint16 mostRecentTotalEpoch = totalLQTYAllocationByEpoch.getHead();

        _setTotalLQTYAllocationByEpoch(
            _currentEpoch, 
            _initiativeState.voteLQTY, 
            _initiativeState.averageStakingTimestampVoteLQTY, 
            mostRecentTotalEpoch != _currentEpoch /// Insert if current > recent
        );

        _setLQTYAllocationByUserAtEpoch(
            _user, 
            _currentEpoch, 
            _allocation.voteLQTY, 
            _userState.averageStakingTimestamp, 
            mostRecentUserEpoch != _currentEpoch /// Insert if user current > recent
        );
    }

@jltqy jltqy marked this pull request as ready for review October 9, 2024 12:25
@GalloDaSballo GalloDaSballo changed the base branch from main to dev October 10, 2024 16:21
@nican0r nican0r closed this Oct 10, 2024
@GalloDaSballo GalloDaSballo deleted the fix/bribe-accounting branch October 14, 2024 16:21
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