-
Notifications
You must be signed in to change notification settings - Fork 0
/
unresolvable_dispute_game.gate
37 lines (30 loc) · 1.29 KB
/
unresolvable_dispute_game.gate
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
use BlockTimestamp, Call from hexagate;
// Parameters
param disputeGame: address;
// extraTimeInSeconds adds more time to the expected resolution date of a dispute game, mostly to handle
// the situation where the game is handling clock extensions, which can extend a game past 7 days
param extraTimeInSeconds: integer;
// Fetch the creation timestamp of the dispute game
source creationTimestamp: integer = Call {
contract: disputeGame,
signature: "function createdAt() returns (uint256)"
};
// Fetch the max clock duration for the dispute game
source gameDuration: integer = Call {
contract: disputeGame,
signature: "function maxClockDuration() returns (uint256)"
};
// Fetch the resolved timestamp of the dispute game
source resolvedAt: integer = Call {
contract: disputeGame,
signature: "function resolvedAt() returns (uint256)"
};
// Calculate the expected resolution timestamp
source expectedResolutionTimestamp: integer = creationTimestamp + (2 * gameDuration) + extraTimeInSeconds;
// Get the current block timestamp
source currentTimestamp: integer = BlockTimestamp {};
// Define the invariant to alert if the dispute game is unresolved
invariant {
description: "Dispute game is unresolved",
condition: resolvedAt != 0 or currentTimestamp <= (expectedResolutionTimestamp)
};