From 1ec7eaed62e204a3e3d5eae84cc6063022e8ba44 Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Fri, 6 Dec 2024 12:45:25 +0100 Subject: [PATCH] Deprecate isReserveLow on L2 --- packages/protocol/contracts/governance/EpochRewards.sol | 5 ++++- .../test-sol/unit/governance/network/EpochRewards.t.sol | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/protocol/contracts/governance/EpochRewards.sol b/packages/protocol/contracts/governance/EpochRewards.sol index 63d5495beb..44e27f1b0c 100644 --- a/packages/protocol/contracts/governance/EpochRewards.sol +++ b/packages/protocol/contracts/governance/EpochRewards.sol @@ -164,8 +164,11 @@ contract EpochRewards is * @notice Determines if the reserve is low enough to demand a diversion from * the community reward. Targets initial critical ratio of 2 with a linear * decline until 25 years have passed where the critical ratio will be 1. + * @dev This function is called by L1 celo-blockchain during epoch reward + * distribution. + * @dev TODO Remove this after the L2 transition. */ - function isReserveLow() external view returns (bool) { + function isReserveLow() external view onlyL1 returns (bool) { // critical reserve ratio = 2 - time in second / 25 years FixidityLib.Fraction memory timeSinceInitialization = FixidityLib.newFixed(now.sub(startTime)); FixidityLib.Fraction memory m = FixidityLib.newFixed(25 * 365 * 1 days); diff --git a/packages/protocol/test-sol/unit/governance/network/EpochRewards.t.sol b/packages/protocol/test-sol/unit/governance/network/EpochRewards.t.sol index 8aaf717745..b8f4624c2e 100644 --- a/packages/protocol/test-sol/unit/governance/network/EpochRewards.t.sol +++ b/packages/protocol/test-sol/unit/governance/network/EpochRewards.t.sol @@ -1028,4 +1028,9 @@ contract EpochRewardsTest_isReserveLow is EpochRewardsTest { } } -contract EpochRewardsTest_isReserveLow_L2 is EpochRewardsTest_L2, EpochRewardsTest_isReserveLow {} +contract EpochRewardsTest_isReserveLow_L2 is EpochRewardsTest_L2 { + function test_ShouldRevert() public { + vm.expectRevert("This method is no longer supported in L2."); + epochRewards.isReserveLow(); + } +}