Skip to content

Commit 63f9b05

Browse files
committed
Remove TargetUnitsUpdated event, update RebalanceStarted event
1 parent 95c6809 commit 63f9b05

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

Diff for: contracts/protocol/modules/GeneralIndexModule.sol

+7-4
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ contract GeneralIndexModule is ModuleBase, ReentrancyGuard {
106106

107107
/* ============ Events ============ */
108108

109-
event TargetUnitsUpdated(ISetToken indexed _setToken, address indexed _component, uint256 _newUnit, uint256 _positionMultiplier);
110109
event TradeMaximumUpdated(ISetToken indexed _setToken, address indexed _component, uint256 _newMaximum);
111110
event AssetExchangeUpdated(ISetToken indexed _setToken, address indexed _component, string _newExchangeName);
112111
event CoolOffPeriodUpdated(ISetToken indexed _setToken, address indexed _component, uint256 _newCoolOffPeriod);
@@ -128,7 +127,12 @@ contract GeneralIndexModule is ModuleBase, ReentrancyGuard {
128127
uint256 _protocolFee
129128
);
130129

131-
event RebalanceStarted(ISetToken indexed _setToken);
130+
event RebalanceStarted(
131+
ISetToken indexed _setToken,
132+
address[] aggregateComponents,
133+
uint256[] aggregateTargetUnits,
134+
uint256 indexed positionMultiplier
135+
);
132136

133137
/* ============ Constants ============ */
134138

@@ -197,13 +201,12 @@ contract GeneralIndexModule is ModuleBase, ReentrancyGuard {
197201
for (uint256 i = 0; i < aggregateComponents.length; i++) {
198202
require(!_setToken.hasExternalPosition(aggregateComponents[i]), "External positions not allowed");
199203
executionInfo[_setToken][IERC20(aggregateComponents[i])].targetUnit = aggregateTargetUnits[i];
200-
emit TargetUnitsUpdated(_setToken, aggregateComponents[i], aggregateTargetUnits[i], _positionMultiplier);
201204
}
202205

203206
rebalanceInfo[_setToken].rebalanceComponents = aggregateComponents;
204207
rebalanceInfo[_setToken].positionMultiplier = _positionMultiplier;
205208

206-
emit RebalanceStarted(_setToken);
209+
emit RebalanceStarted(_setToken, aggregateComponents, aggregateTargetUnits, _positionMultiplier);
207210
}
208211

209212
/**

Diff for: test/protocol/modules/generalIndexModule.spec.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,16 @@ describe("GeneralIndexModule", () => {
357357
});
358358

359359
it("emits the correct RebalanceStarted event", async () => {
360+
const currentComponents = await subjectSetToken.getComponents();
361+
const expectedAggregateComponents = [...currentComponents, ...subjectNewComponents];
362+
const expectedAggregateTargetUnits = [...subjectOldTargetUnits, ...subjectNewTargetUnits];
363+
const expectedPositionMultiplier = await subjectSetToken.positionMultiplier();
364+
360365
await expect(subject()).to.emit(indexModule, "RebalanceStarted").withArgs(
361-
subjectSetToken.address
366+
subjectSetToken.address,
367+
expectedAggregateComponents,
368+
expectedAggregateTargetUnits,
369+
expectedPositionMultiplier
362370
);
363371
});
364372

0 commit comments

Comments
 (0)