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

Low severity #10

Merged
merged 3 commits into from
Jun 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 28 additions & 0 deletions contracts/VoterV3.sol
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@ contract VoterV3 is OwnableUpgradeable, ReentrancyGuardUpgradeable {
event Whitelisted(address indexed whitelister, address indexed token);
event RemovedFromWhitelist(address indexed blacklister, address indexed token);

event SetMinter(address indexed old, address indexed latest);
event SetBribeFactory(address indexed old, address indexed latest);
event SetPairFactory(address indexed old, address indexed latest);
event SetPermissionRegistry(address indexed old, address indexed latest);
event SetGaugeFactory(address indexed old, address indexed latest);
event SetBribeFor(bool isInternal, address indexed old, address indexed latest, address indexed gauge);
event SetVoteDelay(uint old, uint latest);
event AddFactories(address indexed pairfactory, address indexed gaugefactory);

constructor() {}

function initialize(address __ve, address _factory, address _gauges, address _bribes) initializer public {
Expand Down Expand Up @@ -149,41 +158,47 @@ contract VoterV3 is OwnableUpgradeable, ReentrancyGuardUpgradeable {
function setVoteDelay(uint _delay) external VoterAdmin {
require(_delay != VOTE_DELAY, "already set");
require(_delay <= MAX_VOTE_DELAY, "max delay");
emit SetVoteDelay(VOTE_DELAY, _delay);
VOTE_DELAY = _delay;
}

/// @notice Set a new Minter
function setMinter(address _minter) external VoterAdmin {
require(_minter != address(0), "addr0");
require(_minter.code.length > 0, "!contract");
emit SetMinter(minter, _minter);
minter = _minter;
}

/// @notice Set a new Bribe Factory
function setBribeFactory(address _bribeFactory) external VoterAdmin {
require(_bribeFactory.code.length > 0, "!contract");
require(_bribeFactory != address(0), "addr0");
emit SetBribeFactory(bribefactory, _bribeFactory);
bribefactory = _bribeFactory;
}

/// @notice Set a new Gauge Factory
function setGaugeFactory(address _gaugeFactory) external VoterAdmin {
require(_gaugeFactory.code.length > 0, "!contract");
require(_gaugeFactory != address(0), "addr0");
emit SetGaugeFactory(gaugefactory, _gaugeFactory);
gaugefactory = _gaugeFactory;
}

/// @notice Set a new Pair Factory
function setPairFactory(address _factory) external VoterAdmin {
require(_factory.code.length > 0, "!contract");
require(_factory != address(0), "addr0");
emit SetPairFactory(factory, _factory);
factory = _factory;
}

/// @notice Set a new PermissionRegistry
function setPermissionsRegistry(address _permissionRegistry) external VoterAdmin {
require(_permissionRegistry.code.length > 0, "!contract");
require(_permissionRegistry != address(0), "addr0");
emit SetPermissionRegistry(permissionRegistry, _permissionRegistry);
permissionRegistry = _permissionRegistry;
}

Expand All @@ -209,11 +224,13 @@ contract VoterV3 is OwnableUpgradeable, ReentrancyGuardUpgradeable {

function _setInternalBribe(address _gauge, address _internal) private {
require(_internal.code.length > 0, "!contract");
emit SetBribeFor(true, internal_bribes[_gauge], _internal, _gauge);
internal_bribes[_gauge] = _internal;
}

function _setExternalBribe(address _gauge, address _external) private {
require(_external.code.length > 0, "!contract");
emit SetBribeFor(false, internal_bribes[_gauge], _external, _gauge);
external_bribes[_gauge] = _external;
}

Expand All @@ -231,6 +248,7 @@ contract VoterV3 is OwnableUpgradeable, ReentrancyGuardUpgradeable {
_gaugeFactories.push(_gaugeFactory);
isFactory[_pairFactory] = true;
isGaugeFactory[_gaugeFactory] = true;
emit AddFactories(_pairFactory, _gaugeFactory);
}

function replaceFactory(address _pairFactory, address _gaugeFactory, uint256 _pos) external VoterAdmin {
Expand All @@ -242,11 +260,19 @@ contract VoterV3 is OwnableUpgradeable, ReentrancyGuardUpgradeable {
address oldGF = _gaugeFactories[_pos];
isFactory[oldPF] = false;
isGaugeFactory[oldGF] = false;
<<<<<<< HEAD
factories[_pos] = (_pairFactory);
gaugeFactories[_pos] = (_gaugeFactory);
=======

_factories[_pos] = (_pairFactory);
_gaugeFactories[_pos] = (_gaugeFactory);
>>>>>>> 0c3750050fe4183f8297facd02bffe96efba4525
isFactory[_pairFactory] = true;
isGaugeFactory[_gaugeFactory] = true;

emit SetGaugeFactory(oldGF, _gaugeFactory);
emit SetPairFactory(oldPF, _pairFactory);
}

function removeFactory(uint256 _pos) external VoterAdmin {
Expand All @@ -259,6 +285,8 @@ contract VoterV3 is OwnableUpgradeable, ReentrancyGuardUpgradeable {
_gaugeFactories[_pos] = address(0);
isFactory[oldPF] = false;
isGaugeFactory[oldGF] = false;
emit SetGaugeFactory(oldGF, address(0));
emit SetPairFactory(oldPF, address(0));
}


Expand Down