Authority utils assembly (#5074)
This commit is contained in:
@ -17,16 +17,16 @@ library AuthorityUtils {
|
|||||||
address target,
|
address target,
|
||||||
bytes4 selector
|
bytes4 selector
|
||||||
) internal view returns (bool immediate, uint32 delay) {
|
) internal view returns (bool immediate, uint32 delay) {
|
||||||
(bool success, bytes memory data) = authority.staticcall(
|
bytes memory data = abi.encodeCall(IAuthority.canCall, (caller, target, selector));
|
||||||
abi.encodeCall(IAuthority.canCall, (caller, target, selector))
|
|
||||||
);
|
assembly ("memory-safe") {
|
||||||
if (success) {
|
mstore(0x00, 0x00)
|
||||||
if (data.length >= 0x40) {
|
mstore(0x20, 0x00)
|
||||||
(immediate, delay) = abi.decode(data, (bool, uint32));
|
|
||||||
} else if (data.length >= 0x20) {
|
if staticcall(gas(), authority, add(data, 0x20), mload(data), 0x00, 0x40) {
|
||||||
immediate = abi.decode(data, (bool));
|
immediate := mload(0x00)
|
||||||
|
delay := mload(0x20)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (immediate, delay);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user