Skip to content

Commit

Permalink
refactor: adding to Vote Weighting
Browse files Browse the repository at this point in the history
  • Loading branch information
kupermind committed Mar 20, 2024
1 parent 3050ada commit cb201a4
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions contracts/VoteWeighting.sol
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,7 @@ contract VoteWeighting is IErrors {

/// @notice Add gauge `addr` of type `gauge_type` with weight `weight`.
/// @param addr Gauge address.
/// @param weight Gauge weight.
function add_gauge(address addr, uint256 weight) external {
function add_gauge(address addr) external {

Check warning on line 196 in contracts/VoteWeighting.sol

View workflow job for this annotation

GitHub Actions / build

Function name must be in mixedCase
if (mapGauges[addr]) {
revert("Cannot add the same gauge twice");
}
Expand All @@ -204,15 +203,6 @@ contract VoteWeighting is IErrors {

uint256 next_time = (block.timestamp + WEEK) / WEEK * WEEK;

if (weight > 0) {
uint256 _old_sum = _getSum();

points_sum[next_time].bias = weight + _old_sum;
time_sum = next_time;

points_weight[addr][next_time].bias = weight;
}

if (time_sum == 0) {
time_sum = next_time;
}
Expand Down Expand Up @@ -281,6 +271,7 @@ contract VoteWeighting is IErrors {
return _gauge_relative_weight(addr, block.timestamp);
}

// TODO: Supposedly this can only bring weight to zero if something went wrong with the contract
function _change_gauge_weight(address addr, uint256 weight) internal {
// Change gauge weight
// Only needed when testing in reality
Expand Down

0 comments on commit cb201a4

Please sign in to comment.