Skip to content

Commit

Permalink
chore: include code that can be uncommented when new staking contract…
Browse files Browse the repository at this point in the history
…s are added
  • Loading branch information
naddison36 committed Oct 26, 2021
1 parent bf686cb commit 75d352b
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion contracts/emissions/EmissionsController.sol
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,14 @@ contract EmissionsController is IGovernanceHook, Initializable, ImmutableModule

// VOTING

/// @dev The number of staking contracts is fixed for each implementation.
/// More can be added but requires the proxy contract to be upgraded to a new implementation
uint256 constant NumStakingContract = 2;
IVotes immutable stakingContract1;
IVotes immutable stakingContract2;
// More immutable variables can be added if the contract is upgraded
// IVotes immutable stakingContract3;
// IVotes immutable stakingContract4;

/// @notice list of dial data including weightedVotes, rewards balance, recipient contract and disabled flag.
DialData[] public dials;
Expand All @@ -70,6 +76,9 @@ contract EmissionsController is IGovernanceHook, Initializable, ImmutableModule
modifier onlyStakingContract() {
require(address(stakingContract1) == msg.sender ||
address(stakingContract2) == msg.sender,
// Add if contract is upgraded with more staking contracts
// address(stakingContract3) == msg.sender ||
// address(stakingContract4) == msg.sender,
"Must be staking contract");
_;
}
Expand All @@ -86,7 +95,7 @@ contract EmissionsController is IGovernanceHook, Initializable, ImmutableModule
*/
constructor(
address _nexus,
address[2] memory _stakingContracts,
address[NumStakingContract] memory _stakingContracts,
address _rewardToken,
uint256 _totalRewardsAmount
) ImmutableModule(_nexus) {
Expand All @@ -97,6 +106,9 @@ contract EmissionsController is IGovernanceHook, Initializable, ImmutableModule
require(_stakingContracts[0] != address(0) && _stakingContracts[1] != address(0), "Staking contract address is zero");
stakingContract1 = IVotes(_stakingContracts[0]);
stakingContract2 = IVotes(_stakingContracts[1]);
// Add if contract is upgraded to include more staking contracts.
// stakingContract2 = IVotes(_stakingContracts[2]);
// stakingContract3 = IVotes(_stakingContracts[3]);
}

/**
Expand Down Expand Up @@ -139,6 +151,9 @@ contract EmissionsController is IGovernanceHook, Initializable, ImmutableModule
function getVotes(address account) public returns (uint256 votingPower) {
votingPower = stakingContract1.getVotes(account);
votingPower += stakingContract2.getVotes(account);
// Add if contract is upgraded to include more staking contracts
// votingPower += stakingContract3.getVotes(account);
// votingPower += stakingContract4.getVotes(account);
}

/***************************************
Expand Down

0 comments on commit 75d352b

Please sign in to comment.