Skip to content

Commit a8ec07e

Browse files
committed
refactor: event args
.
1 parent bcb7728 commit a8ec07e

File tree

4 files changed

+34
-28
lines changed

4 files changed

+34
-28
lines changed

src/XanV1.sol

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,13 @@ contract XanV1 is
209209
{
210210
Council.Data storage councilData = _getCouncilData();
211211
if (councilData.scheduledEndTime != 0 && councilData.scheduledImpl != address(0)) {
212-
_cancelCouncilUpgrade();
212+
// TODO! Ask Chris: Should we check `_checkDelayCriterion(councilData.scheduledEndTime);`
213213

214-
emit CouncilUpgradeVetoed(); // TODO! Revisit event args
214+
emit CouncilUpgradeVetoed(councilData.scheduledImpl);
215+
216+
// Reset the scheduled
217+
councilData.scheduledImpl = address(0);
218+
councilData.scheduledEndTime = 0;
215219
}
216220
}
217221
}
@@ -220,10 +224,9 @@ contract XanV1 is
220224
function cancelVoterBodyUpgrade() external override {
221225
Voting.Data storage data = _getVotingData();
222226

227+
// TODO! Confirm with Chris
223228
_checkDelayCriterion(data.scheduledEndTime);
224229

225-
// TODO! check min quorum
226-
227230
// Revert the cancellation if the currently scheduled implementation still
228231
// * meets the quorum and minimum locked supply for the
229232
// * is the best ranked implementation
@@ -235,7 +238,7 @@ contract XanV1 is
235238
revert UpgradeCancellationInvalid(data.scheduledImpl, data.scheduledEndTime);
236239
}
237240

238-
emit VoterBodyUpgradeCancelled(data.scheduledImpl, data.scheduledEndTime);
241+
emit VoterBodyUpgradeCancelled(data.scheduledImpl);
239242

240243
// Reset the scheduled upgrade
241244
data.scheduledImpl = address(0);
@@ -271,8 +274,15 @@ contract XanV1 is
271274

272275
/// @notice @inheritdoc IXanV1
273276
function cancelCouncilUpgrade() external override onlyCouncil {
274-
emit CouncilUpgradeCancelled();
275-
_cancelCouncilUpgrade();
277+
Council.Data storage data = _getCouncilData();
278+
279+
// TODO! Ask Chris: Should we check `_checkDelayCriterion(data.scheduledEndTime);`
280+
281+
emit CouncilUpgradeCancelled(data.scheduledImpl);
282+
283+
// Reset the scheduled
284+
data.scheduledImpl = address(0);
285+
data.scheduledEndTime = 0;
276286
}
277287

278288
/// @notice @inheritdoc IXanV1
@@ -290,10 +300,15 @@ contract XanV1 is
290300
revert QuorumOrMinLockedSupplyNotReached(bestRankedImplementation);
291301
}
292302

293-
emit CouncilUpgradeVetoed();
303+
Council.Data storage data = _getCouncilData();
304+
305+
// TODO! Ask Chris: Should we check `_checkDelayCriterion(data.scheduledEndTime);`
294306

295-
// Cancel the council upgrade
296-
_cancelCouncilUpgrade();
307+
emit CouncilUpgradeVetoed(data.scheduledImpl);
308+
309+
// Reset the scheduled upgrade
310+
data.scheduledImpl = address(0);
311+
data.scheduledEndTime = 0;
297312
}
298313

299314
/// @inheritdoc IXanV1
@@ -400,14 +415,6 @@ contract XanV1 is
400415
emit Locked({account: account, value: value});
401416
}
402417

403-
/// @notice Cancels the scheduled upgrade by the council by resetting it to 0.
404-
function _cancelCouncilUpgrade() internal {
405-
Council.Data storage data = _getCouncilData();
406-
407-
data.scheduledImpl = address(0);
408-
data.scheduledEndTime = 0;
409-
}
410-
411418
/// @notice Authorizes an upgrade.
412419
/// @param newImpl The new implementation to authorize the upgrade to.
413420
function _authorizeUpgrade(address newImpl) internal view override {

src/interfaces/IXanV1.sol

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,21 @@ interface IXanV1 {
2626

2727
/// @notice Emitted when the upgrade to a new implementation proposed by the voter body is cancelled.
2828
/// @param impl The implementation that has been cancelled.
29-
/// @param endTime The end time of the delay period.
30-
event VoterBodyUpgradeCancelled(address indexed impl, uint48 endTime);
29+
event VoterBodyUpgradeCancelled(address indexed impl);
3130

3231
/// @notice Emitted when the upgrade to a new implementation proposed by the governance council is scheduled.
3332
/// @param impl The implementation that has been scheduled.
3433
/// @param endTime The end time of the delay period.
3534
event CouncilUpgradeScheduled(address indexed impl, uint48 endTime);
3635

3736
/// @notice Emitted when the upgrade scheduled by the governance council is cancelled.
38-
// TODO! do we need to emit data
39-
event CouncilUpgradeCancelled();
37+
/// @param impl The implementation to which the upgrade has been cancelled by the governance council.
38+
event CouncilUpgradeCancelled(address indexed impl);
4039

4140
/// @notice Emitted when the upgrade to a new implementation proposed by the governance council is vetoed
4241
/// by the voter body.
43-
event CouncilUpgradeVetoed();
42+
/// @param impl The implementation to which the upgrade has been vetoed by the voter body.
43+
event CouncilUpgradeVetoed(address indexed impl);
4444

4545
/// @notice Permanently locks tokens for the current implementation until it gets upgraded.
4646
/// @param value The value to be locked.

test/XanV1.council.t.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ contract XanV1CouncilTest is Test {
121121
_xanProxy.scheduleCouncilUpgrade(_NEW_IMPL);
122122

123123
vm.expectEmit(address(_xanProxy));
124-
emit IXanV1.CouncilUpgradeCancelled();
124+
emit IXanV1.CouncilUpgradeCancelled(_NEW_IMPL);
125125
_xanProxy.cancelCouncilUpgrade();
126126

127127
(address impl, uint48 endTime) = _xanProxy.scheduledVoterBodyUpgrade();
@@ -180,7 +180,7 @@ contract XanV1CouncilTest is Test {
180180
vm.stopPrank();
181181

182182
vm.expectEmit(address(_xanProxy));
183-
emit IXanV1.CouncilUpgradeVetoed();
183+
emit IXanV1.CouncilUpgradeVetoed(_NEW_IMPL);
184184
_xanProxy.vetoCouncilUpgrade();
185185
}
186186

test/XanV1.voting.t.sol

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ contract XanV1VotingTest is Test {
306306
emit IXanV1.VoterBodyUpgradeScheduled(_NEW_IMPL, Time.timestamp() + Parameters.DELAY_DURATION);
307307

308308
vm.expectEmit(address(_xanProxy));
309-
emit IXanV1.CouncilUpgradeVetoed();
309+
emit IXanV1.CouncilUpgradeVetoed(_OTHER_NEW_IMPL);
310310
_xanProxy.scheduleVoterBodyUpgrade();
311311
}
312312

@@ -346,7 +346,6 @@ contract XanV1VotingTest is Test {
346346
_xanProxy.lock(Parameters.MIN_LOCKED_SUPPLY);
347347
_xanProxy.castVote(_NEW_IMPL);
348348

349-
uint48 endTime = Time.timestamp() + Parameters.DELAY_DURATION;
350349
_xanProxy.scheduleVoterBodyUpgrade();
351350

352351
// Vote with more weight for another implementation
@@ -362,7 +361,7 @@ contract XanV1VotingTest is Test {
362361

363362
// Cancel the upgrade
364363
vm.expectEmit(address(_xanProxy));
365-
emit IXanV1.VoterBodyUpgradeCancelled(_NEW_IMPL, endTime);
364+
emit IXanV1.VoterBodyUpgradeCancelled(_NEW_IMPL);
366365
_xanProxy.cancelVoterBodyUpgrade();
367366
}
368367

0 commit comments

Comments
 (0)