From fd5bd7f863bc72a9d1facb56143d3a2ede3d0bf8 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Ubeira Date: Thu, 30 May 2024 10:44:35 -0300 Subject: [PATCH 1/2] Optimism --> Optimistic gauges, with public network tag. --- .../OptimisticRootGauge.sol} | 7 +++++-- .../OptimisticRootGaugeFactory.sol} | 14 +++++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) rename pkg/liquidity-mining/contracts/gauges/{optimism/OptimismRootGauge.sol => optimistic/OptimisticRootGauge.sol} (94%) rename pkg/liquidity-mining/contracts/gauges/{optimism/OptimismRootGaugeFactory.sol => optimistic/OptimisticRootGaugeFactory.sol} (83%) diff --git a/pkg/liquidity-mining/contracts/gauges/optimism/OptimismRootGauge.sol b/pkg/liquidity-mining/contracts/gauges/optimistic/OptimisticRootGauge.sol similarity index 94% rename from pkg/liquidity-mining/contracts/gauges/optimism/OptimismRootGauge.sol rename to pkg/liquidity-mining/contracts/gauges/optimistic/OptimisticRootGauge.sol index 70187bd743..b3cd8a52f5 100644 --- a/pkg/liquidity-mining/contracts/gauges/optimism/OptimismRootGauge.sol +++ b/pkg/liquidity-mining/contracts/gauges/optimistic/OptimisticRootGauge.sol @@ -21,9 +21,11 @@ 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; + string public NETWORK; + IL1StandardBridge private immutable _optimismL1StandardBridge; address private immutable _optimismBal; IOptimismGasLimitProvider private immutable _factory; @@ -41,11 +43,12 @@ 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) { diff --git a/pkg/liquidity-mining/contracts/gauges/optimism/OptimismRootGaugeFactory.sol b/pkg/liquidity-mining/contracts/gauges/optimistic/OptimisticRootGaugeFactory.sol similarity index 83% rename from pkg/liquidity-mining/contracts/gauges/optimism/OptimismRootGaugeFactory.sol rename to pkg/liquidity-mining/contracts/gauges/optimistic/OptimisticRootGaugeFactory.sol index 7a78356499..64edf5394f 100644 --- a/pkg/liquidity-mining/contracts/gauges/optimism/OptimismRootGaugeFactory.sol +++ b/pkg/liquidity-mining/contracts/gauges/optimistic/OptimisticRootGaugeFactory.sol @@ -18,9 +18,11 @@ 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 { + string public NETWORK; -contract OptimismRootGaugeFactory is IOptimismGasLimitProvider, BaseGaugeFactory, SingletonAuthentication { uint32 private _gasLimit; event OptimismGasLimitModified(uint256 gasLimit); @@ -30,12 +32,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; } /** @@ -55,7 +59,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; } From 77cee40c8bc45cf5d28a092fca30afd8bbef9100 Mon Sep 17 00:00:00 2001 From: Juan Ignacio Ubeira Date: Thu, 30 May 2024 12:44:21 -0300 Subject: [PATCH 2/2] Lint. --- .../contracts/gauges/optimistic/OptimisticRootGauge.sol | 7 ++++++- .../gauges/optimistic/OptimisticRootGaugeFactory.sol | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/liquidity-mining/contracts/gauges/optimistic/OptimisticRootGauge.sol b/pkg/liquidity-mining/contracts/gauges/optimistic/OptimisticRootGauge.sol index b3cd8a52f5..d5c7f4e9fa 100644 --- a/pkg/liquidity-mining/contracts/gauges/optimistic/OptimisticRootGauge.sol +++ b/pkg/liquidity-mining/contracts/gauges/optimistic/OptimisticRootGauge.sol @@ -24,6 +24,7 @@ import "../StakelessGauge.sol"; contract OptimisticRootGauge is StakelessGauge { using SafeERC20 for IERC20; + // solhint-disable-next-line var-name-mixedcase string public NETWORK; IL1StandardBridge private immutable _optimismL1StandardBridge; @@ -43,7 +44,11 @@ contract OptimisticRootGauge is StakelessGauge { _factory = IOptimismGasLimitProvider(msg.sender); } - function initialize(address recipient, uint256 relativeWeightCap, string memory targetNetwork) external { + function initialize( + address recipient, + uint256 relativeWeightCap, + string memory targetNetwork + ) external { // This will revert in all calls except the first one __StakelessGauge_init(relativeWeightCap); diff --git a/pkg/liquidity-mining/contracts/gauges/optimistic/OptimisticRootGaugeFactory.sol b/pkg/liquidity-mining/contracts/gauges/optimistic/OptimisticRootGaugeFactory.sol index 64edf5394f..44f01ecdce 100644 --- a/pkg/liquidity-mining/contracts/gauges/optimistic/OptimisticRootGaugeFactory.sol +++ b/pkg/liquidity-mining/contracts/gauges/optimistic/OptimisticRootGaugeFactory.sol @@ -21,6 +21,7 @@ import "../BaseGaugeFactory.sol"; import "./OptimisticRootGauge.sol"; contract OptimisticRootGaugeFactory is IOptimismGasLimitProvider, BaseGaugeFactory, SingletonAuthentication { + // solhint-disable-next-line var-name-mixedcase string public NETWORK; uint32 private _gasLimit;