Skip to content

Commit

Permalink
perf: evaluate likely condition first
Browse files Browse the repository at this point in the history
CS-CURVE_SCRVUSD-005.1.TWA.1
  • Loading branch information
AlbertoCentonze committed Oct 28, 2024
1 parent a6e254b commit 7871532
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions contracts/TWA.vy
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ def _take_snapshot(_value: uint256):
@notice Stores a snapshot of the tracked value.
@param _value The value to store.
"""
if (len(self.snapshots) == 0) or ( # First snapshot
if ( # First snapshot
self.last_snapshot_timestamp + self.min_snapshot_dt_seconds <= block.timestamp # after dt
):
) or (len(self.snapshots) == 0):
self.last_snapshot_timestamp = block.timestamp
self.snapshots.append(
Snapshot(tracked_value=_value, timestamp=block.timestamp)
Expand Down

0 comments on commit 7871532

Please sign in to comment.