Closed jltqy closed 1 day ago
You can further simplify the logic of onAfterAllocateLQTY
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 ); }
You can further simplify the logic of
onAfterAllocateLQTY
By writing the following: