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

Refactor: Optimism --> Optimistic gauges, with public network tag. #2565

Merged
merged 2 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading