Skip to content

Commit 572a932

Browse files
committed
return leftover
1 parent d90c822 commit 572a932

File tree

1 file changed

+68
-1
lines changed

1 file changed

+68
-1
lines changed

proposals/templates/RewardsDistribution.sol

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ contract RewardsDistributionTemplate is HybridProposal, Networks {
183183
/// @notice Track reserve automation contract balances before proposal execution
184184
mapping(address => uint256) public reserveAutomationBalancesBefore;
185185

186+
/// @notice Track leftover xWELL balance in Temporal Governor on Base before proposal execution
187+
/// TODO: Remove this after x34 - this is a one-time cleanup for leftover funds
188+
uint256 public temporalGovernorLeftoverBalance;
189+
186190
bytes public constant payloadMerkleCampaignBase =
187191
hex"000000000000000000000000a88594d404727625a9437c3f886c7643872296ae00000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000180000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
188192

@@ -230,6 +234,17 @@ contract RewardsDistributionTemplate is HybridProposal, Networks {
230234
);
231235
wellBalancesBefore[reserve] = xwell.balanceOf(reserve);
232236

237+
// On Base, check for leftover xWELL in Temporal Governor
238+
// TODO: Remove this after x34 - this is a one-time cleanup for leftover funds
239+
if (chainId == BASE_CHAIN_ID) {
240+
address temporalGovernor = addresses.getAddress(
241+
"TEMPORAL_GOVERNOR"
242+
);
243+
temporalGovernorLeftoverBalance = xwell.balanceOf(
244+
temporalGovernor
245+
);
246+
}
247+
233248
// Save initial balances for reserve automation contracts
234249
JsonSpecExternalChain memory spec = externalChainActions[
235250
chainId
@@ -1313,6 +1328,27 @@ contract RewardsDistributionTemplate is HybridProposal, Networks {
13131328
}
13141329
}
13151330

1331+
// On Base, return any leftover xWELL in Temporal Governor to F-GLMR-DEVGRANT
1332+
// TODO: Remove this after x34 - this is a one-time cleanup for leftover funds
1333+
if (_chainId == BASE_CHAIN_ID && temporalGovernorLeftoverBalance > 0) {
1334+
address xwell = addresses.getAddress("xWELL_PROXY");
1335+
address devGrant = addresses.getAddress("F-GLMR-DEVGRANT");
1336+
1337+
_pushAction(
1338+
xwell,
1339+
abi.encodeWithSignature(
1340+
"transfer(address,uint256)",
1341+
devGrant,
1342+
temporalGovernorLeftoverBalance
1343+
),
1344+
string.concat(
1345+
"Return leftover ",
1346+
vm.toString(temporalGovernorLeftoverBalance / 1e18),
1347+
" xWELL from Temporal Governor to F-GLMR-DEVGRANT on Base"
1348+
)
1349+
);
1350+
}
1351+
13161352
for (uint256 i = 0; i < spec.setRewardSpeed.length; i++) {
13171353
SetMRDRewardSpeed memory setRewardSpeed = spec.setRewardSpeed[i];
13181354

@@ -1754,7 +1790,7 @@ contract RewardsDistributionTemplate is HybridProposal, Networks {
17541790
(uint256 quoteEVMDeliveryPrice, ) = relayer
17551791
.quoteEVMDeliveryPrice(wormholeChainId, 0, gasLimit);
17561792

1757-
uint256 expectedValue = quoteEVMDeliveryPrice * 4;
1793+
uint256 expectedValue = quoteEVMDeliveryPrice * 5;
17581794

17591795
assertEq(
17601796
router.bridgeCost(wormholeChainId),
@@ -2056,6 +2092,37 @@ contract RewardsDistributionTemplate is HybridProposal, Networks {
20562092
}
20572093
}
20582094

2095+
// Validate leftover xWELL transfer on Base
2096+
// TODO: Remove this after x34 - this is a one-time cleanup for leftover funds
2097+
if (_chainId == BASE_CHAIN_ID && temporalGovernorLeftoverBalance > 0) {
2098+
address temporalGovernor = addresses.getAddress(
2099+
"TEMPORAL_GOVERNOR"
2100+
);
2101+
address devGrant = addresses.getAddress("F-GLMR-DEVGRANT");
2102+
IERC20 xwell = IERC20(addresses.getAddress("xWELL_PROXY"));
2103+
2104+
// Verify F-GLMR-DEVGRANT received the leftover amount
2105+
uint256 expectedDevGrantBalance = wellBalancesBefore[devGrant] +
2106+
temporalGovernorLeftoverBalance;
2107+
assertEq(
2108+
xwell.balanceOf(devGrant),
2109+
expectedDevGrantBalance,
2110+
string.concat(
2111+
"F-GLMR-DEVGRANT should have received leftover ",
2112+
vm.toString(temporalGovernorLeftoverBalance / 1e18),
2113+
" xWELL from Temporal Governor"
2114+
)
2115+
);
2116+
2117+
// Verify Temporal Governor balance is now zero or only has new transfers
2118+
uint256 currentTempGovBalance = xwell.balanceOf(temporalGovernor);
2119+
assertEq(
2120+
currentTempGovBalance,
2121+
0,
2122+
"Temporal Governor should have zero xWELL balance after returning leftovers"
2123+
);
2124+
}
2125+
20592126
{
20602127
// validate emissions per second for the Safety Module
20612128
IStakedWell stkWell = IStakedWell(

0 commit comments

Comments
 (0)