mirror of
https://github.com/luxfi/uma.git
synced 2026-10-30 15:14:44 +00:00
31 lines
795 B
Solidity
31 lines
795 B
Solidity
// SPDX-License-Identifier: AGPL-3.0-only
|
|
pragma solidity ^0.8.0;
|
|
|
|
/**
|
|
* @title Universal store of current contract time for testing environments.
|
|
*/
|
|
contract Timer {
|
|
uint256 private currentTime;
|
|
|
|
constructor() {
|
|
currentTime = block.timestamp; // solhint-disable-line not-rely-on-time
|
|
}
|
|
|
|
/**
|
|
* @notice Sets the current time.
|
|
* @dev Will revert if not running in test mode.
|
|
* @param time timestamp to set `currentTime` to.
|
|
*/
|
|
function setCurrentTime(uint256 time) external {
|
|
currentTime = time;
|
|
}
|
|
|
|
/**
|
|
* @notice Gets the currentTime variable set in the Timer.
|
|
* @return uint256 for the current Testable timestamp.
|
|
*/
|
|
function getCurrentTime() public view returns (uint256) {
|
|
return currentTime;
|
|
}
|
|
}
|