-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathOptInServiceHints.sol
39 lines (32 loc) · 1.12 KB
/
OptInServiceHints.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.25;
import {Hints} from "./Hints.sol";
import {OptInService} from "../service/OptInService.sol";
import {Checkpoints} from "../libraries/Checkpoints.sol";
contract OptInServiceHints is Hints, OptInService {
using Checkpoints for Checkpoints.Trace208;
constructor() OptInService(address(0), address(0), "") {}
function optInHintInternal(
address who,
address where,
uint48 timestamp
) external view internalFunction returns (bool exists, uint32 hint) {
(exists,,, hint) = _isOptedIn[who][where].upperLookupRecentCheckpoint(timestamp);
}
function optInHint(
address optInService,
address who,
address where,
uint48 timestamp
) external view returns (bytes memory) {
(bool exists, uint32 hint_) = abi.decode(
_selfStaticDelegateCall(
optInService, abi.encodeCall(OptInServiceHints.optInHintInternal, (who, where, timestamp))
),
(bool, uint32)
);
if (exists) {
return abi.encode(hint_);
}
}
}