Skip to content

Commit

Permalink
Refactor: Optimism --> Optimistic gauges, with public network tag. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jubeira authored May 31, 2024
1 parent 66b40de commit 281e98f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ import "@balancer-labs/v2-solidity-utils/contracts/openzeppelin/SafeERC20.sol";

import "../StakelessGauge.sol";

contract OptimismRootGauge is StakelessGauge {
contract OptimisticRootGauge is StakelessGauge {
using SafeERC20 for IERC20;

// solhint-disable-next-line var-name-mixedcase
string public NETWORK;

IL1StandardBridge private immutable _optimismL1StandardBridge;
address private immutable _optimismBal;
IOptimismGasLimitProvider private immutable _factory;
Expand All @@ -41,11 +44,16 @@ contract OptimismRootGauge is StakelessGauge {
_factory = IOptimismGasLimitProvider(msg.sender);
}

function initialize(address recipient, uint256 relativeWeightCap) external {
function initialize(
address recipient,
uint256 relativeWeightCap,
string memory targetNetwork
) external {
// This will revert in all calls except the first one
__StakelessGauge_init(relativeWeightCap);

_recipient = recipient;
NETWORK = targetNetwork;
}

function getRecipient() external view override returns (address) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ pragma experimental ABIEncoderV2;
import "@balancer-labs/v2-solidity-utils/contracts/helpers/SingletonAuthentication.sol";

import "../BaseGaugeFactory.sol";
import "./OptimismRootGauge.sol";
import "./OptimisticRootGauge.sol";

contract OptimisticRootGaugeFactory is IOptimismGasLimitProvider, BaseGaugeFactory, SingletonAuthentication {
// solhint-disable-next-line var-name-mixedcase
string public NETWORK;

contract OptimismRootGaugeFactory is IOptimismGasLimitProvider, BaseGaugeFactory, SingletonAuthentication {
uint32 private _gasLimit;

event OptimismGasLimitModified(uint256 gasLimit);
Expand All @@ -30,12 +33,14 @@ contract OptimismRootGaugeFactory is IOptimismGasLimitProvider, BaseGaugeFactory
IMainnetBalancerMinter minter,
IL1StandardBridge optimismL1StandardBridge,
address optimismBal,
uint32 gasLimit
uint32 gasLimit,
string memory targetNetwork
)
BaseGaugeFactory(address(new OptimismRootGauge(minter, optimismL1StandardBridge, optimismBal)))
BaseGaugeFactory(address(new OptimisticRootGauge(minter, optimismL1StandardBridge, optimismBal)))
SingletonAuthentication(vault)
{
_gasLimit = gasLimit;
NETWORK = targetNetwork;
}

/**
Expand All @@ -55,7 +60,7 @@ contract OptimismRootGaugeFactory is IOptimismGasLimitProvider, BaseGaugeFactory
*/
function create(address recipient, uint256 relativeWeightCap) external returns (address) {
address gauge = _create();
OptimismRootGauge(gauge).initialize(recipient, relativeWeightCap);
OptimisticRootGauge(gauge).initialize(recipient, relativeWeightCap, NETWORK);
return gauge;
}

Expand Down

0 comments on commit 281e98f

Please sign in to comment.