Skip to main content

TimelockExpiry

A policy that restricts reveals to a specific time window.

Address: 0xae2307620840916a06A862A61BF2101d694539d6

Parameters

The policy params encode two timestamps:

(uint256 notBefore, uint256 notAfter) = abi.decode(policyParams, (uint256, uint256));
ParameterDescription
notBeforeEarliest timestamp for reveal (0 = no lower bound)
notAfterLatest timestamp for reveal (0 = no upper bound)

Validation logic

if (notBefore > 0) require(block.timestamp >= notBefore);
if (notAfter > 0) require(block.timestamp <= notAfter);

Examples

Reveal only after 1 hour

const notBefore = Math.floor(Date.now() / 1000) + 3600;
const notAfter = 0; // no upper bound
const policyParams = ethers.AbiCoder.defaultAbiCoder().encode(
['uint256', 'uint256'],
[notBefore, notAfter]
);

Reveal within a 24-hour window

const now = Math.floor(Date.now() / 1000);
const notBefore = now + 3600; // starts in 1 hour
const notAfter = now + 86400; // expires in 24 hours

Reveal before a deadline (expiry)

const notBefore = 0;                // immediate
const notAfter = Math.floor(Date.now() / 1000) + 604800; // 7 days