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