Skip to content

Commit

Permalink
T
Browse files Browse the repository at this point in the history
  • Loading branch information
Vectorized committed Feb 5, 2024
1 parent c9a8334 commit 02f014f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
11 changes: 7 additions & 4 deletions contracts/modules/CoreActions.sol
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ contract CoreActions is ICoreActions, EIP712 {
address target,
address actor
) public view returns (uint32) {
target = IAddressAliasRegistry(addressAliasRegistry).addressOf(target);
ActorsAndTimestamps storage m = _coreActions[platform][coreActionType][target];
uint256 actorAlias = uint160(IAddressAliasRegistry(addressAliasRegistry).aliasOf(actor));
return m.timestamps.get(actorAlias);
Expand All @@ -228,6 +229,7 @@ contract CoreActions is ICoreActions, EIP712 {
uint256 coreActionType,
address target
) public view returns (uint256) {
target = IAddressAliasRegistry(addressAliasRegistry).addressOf(target);
return _coreActions[platform][coreActionType][target].length;
}

Expand All @@ -239,8 +241,7 @@ contract CoreActions is ICoreActions, EIP712 {
uint256 coreActionType,
address target
) public view returns (address[] memory actors, uint32[] memory timestamps) {
ActorsAndTimestamps storage m = _coreActions[platform][coreActionType][target];
return getCoreActionsIn(platform, coreActionType, target, 0, m.length);
return getCoreActionsIn(platform, coreActionType, target, 0, type(uint256).max);
}

/**
Expand All @@ -253,11 +254,13 @@ contract CoreActions is ICoreActions, EIP712 {
uint256 start,
uint256 stop
) public view returns (address[] memory actors, uint32[] memory timestamps) {
target = IAddressAliasRegistry(addressAliasRegistry).addressOf(target);
ActorsAndTimestamps storage m = _coreActions[platform][coreActionType][target];
unchecked {
uint256 l = stop - start;
uint256 n = m.length;
if (start > stop || stop > n) revert InvalidQueryRange();
if (stop > n) stop = n;
uint256 l = stop - start;
if (start > stop) revert InvalidQueryRange();
actors = new address[](l);
timestamps = new uint32[](l);
IAddressAliasRegistry registry = IAddressAliasRegistry(addressAliasRegistry);
Expand Down
18 changes: 11 additions & 7 deletions contracts/modules/interfaces/ICoreActions.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ interface ICoreActions {
// The core action type.
uint256 coreActionType;
// The list of targets.
// Can be full addresses or aliases.
address[] targets;
// The list of lists of timestamps. Must have the same dimensions as `actors`.
// The list of lists of timestamps.
// Can be full addresses or aliases.
// Must have the same dimensions as `actors`.
address[][] actors;
// The list of lists of timestamps. Must have the same dimensions as `actors`.
// The list of lists of timestamps.
// Must have the same dimensions as `actors`.
uint32[][] timestamps;
// The nonce of the signature (per platform's signer).
uint256 nonce;
Expand Down Expand Up @@ -154,7 +158,7 @@ interface ICoreActions {
* @param coreActionType The core action type.
* @param target The core action target.
* @param actor The actor
* @return The amped timestamp value.
* @return The timestamp value.
*/
function getCoreActionTimestamp(
address platform,
Expand Down Expand Up @@ -183,8 +187,8 @@ interface ICoreActions {
* @param platform The platform.
* @param coreActionType The core action type.
* @param target The core action target.
* @return actors The actors for the coreActions.
* @return timestamps The timestamps of the coreActions.
* @return actors The actors for the core actions.
* @return timestamps The timestamps of the core actions.
*/
function getCoreActions(
address platform,
Expand All @@ -200,8 +204,8 @@ interface ICoreActions {
* @param target The core action target.
* @param start The start index of the range.
* @param stop The end index of the range (exclusive).
* @return actors The actors for the coreActions.
* @return timestamps The timestamps of the coreActions.
* @return actors The actors for the core actions.
* @return timestamps The timestamps of the core actions.
*/
function getCoreActionsIn(
address platform,
Expand Down

0 comments on commit 02f014f

Please sign in to comment.