Refactor Time library to use valueBefore/valueAfter (#4555)

Co-authored-by: Francisco <fg@frang.io>
This commit is contained in:
Hadrien Croubois
2023-09-06 04:19:21 +02:00
committed by GitHub
parent bb7ca7d151
commit 87f7a2cd42
11 changed files with 203 additions and 45 deletions

View File

@ -60,7 +60,7 @@ contract AccessManager is Context, Multicall, IAccessManager {
// Structure that stores the details for a group/account pair. This structure fits into a single slot.
struct Access {
// Timepoint at which the user gets the permission. If this is either 0, or in the future, the group permission
// is not available. Should be checked using {Time-isSetAndPast}
// is not available.
uint48 since;
// delay for execution. Only applies to restricted() / relay() calls. This does not restrict access to
// functions that use the `onlyGroup` modifier.
@ -235,7 +235,7 @@ contract AccessManager is Context, Multicall, IAccessManager {
return (true, 0);
} else {
(uint48 inGroupSince, uint32 currentDelay, , ) = getAccess(groupId, account);
return (inGroupSince.isSetAndPast(Time.timestamp()), currentDelay);
return (inGroupSince != 0 && inGroupSince <= Time.timestamp(), currentDelay);
}
}