Skip to content

Commit 5eba5c0

Browse files
committed
include owner
1 parent f556bfd commit 5eba5c0

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/MaglevLens.sol

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ contract MaglevLens {
274274

275275
error MultipleControllers();
276276

277-
/// Packed health score: controller (address), health (uint32), error (bool)
277+
/// Packed health score: controller (address), subAccount (uint8), health (uint32), error (bool)
278278
/// @dev Health scores are 1e6 scale.
279279
function getHealthScores(address evc, address[] calldata addrs) external view returns (uint256[] memory healths) {
280280
healths = new uint256[](addrs.length);
@@ -283,9 +283,12 @@ contract MaglevLens {
283283
address addr = addrs[i];
284284

285285
address controller;
286+
uint8 subAccountId;
286287
uint32 health;
287288
uint8 errorFlag;
288289

290+
subAccountId = uint8((uint160(IEVC(evc).getAccountOwner(addr)) ^ uint160(addr)) & 0xFF);
291+
289292
{
290293
address[] memory controllers = IEVC(evc).getControllers(addr);
291294
require(controllers.length < 2, MultipleControllers());
@@ -311,7 +314,11 @@ contract MaglevLens {
311314
}
312315
}
313316

314-
healths[i] = (uint160(controller) << 40) | (health << 32) | errorFlag;
317+
uint256 o = uint160(controller);
318+
o = (o << 8) | subAccountId;
319+
o = (o << 32) | health;
320+
o = (o << 8) | errorFlag;
321+
healths[i] = o;
315322
}
316323
}
317324
}

0 commit comments

Comments
 (0)