@@ -105,7 +105,7 @@ contract RocketNetworkRevenues is RocketBase, RocketNetworkRevenuesInterface {
105105
106106 /// @notice Calculates the time-weighted average revenue split values between the supplied timestamp and now
107107 /// @param _sinceTime The starting block timestamp for the calculation
108- function calculateSplit (uint256 _sinceTime ) external override view returns (uint256 nodeShare , uint256 voterShare , uint256 protocolDAOShare , uint256 rethShare ) {
108+ function calculateSplit (uint64 _sinceTime ) external override view returns (uint256 nodeShare , uint256 voterShare , uint256 protocolDAOShare , uint256 rethShare ) {
109109 RocketNetworkSnapshotsTimeInterface rocketNetworkSnapshotsTime = RocketNetworkSnapshotsTimeInterface (getContractAddress ("rocketNetworkSnapshotsTime " ));
110110 if (_sinceTime == block .timestamp ) {
111111 nodeShare = _getCurrentShare (rocketNetworkSnapshotsTime, nodeShareKey, true );
@@ -150,7 +150,7 @@ contract RocketNetworkRevenues is RocketBase, RocketNetworkRevenuesInterface {
150150 /// @notice Returns the average capital ratio of the given node operator since a given block
151151 /// @param _nodeAddress Address of the node operator to query the value for
152152 /// @param _sinceTime The timestamp to calculate the average since
153- function getNodeAverageCapitalRatioSince (address _nodeAddress , uint256 _sinceTime ) external override view returns (uint256 ) {
153+ function getNodeAverageCapitalRatioSince (address _nodeAddress , uint64 _sinceTime ) external override view returns (uint256 ) {
154154 RocketNetworkSnapshotsTimeInterface rocketNetworkSnapshotsTime = RocketNetworkSnapshotsTimeInterface (getContractAddress ("rocketNetworkSnapshotsTime " ));
155155 bytes32 key = keccak256 (abi.encodePacked ("node.capital.ratio " , _nodeAddress));
156156 if (_sinceTime == block .timestamp ) {
@@ -162,7 +162,7 @@ contract RocketNetworkRevenues is RocketBase, RocketNetworkRevenuesInterface {
162162 }
163163
164164 /// @notice Calculates the time-weighted average since a given block
165- function _getAverageSince (RocketNetworkSnapshotsTimeInterface _rocketNetworkSnapshotsTime , uint256 _sinceTime , bytes32 _key , bool _mustExist ) internal view returns (uint256 ) {
165+ function _getAverageSince (RocketNetworkSnapshotsTimeInterface _rocketNetworkSnapshotsTime , uint64 _sinceTime , bytes32 _key , bool _mustExist ) internal view returns (uint256 ) {
166166 (bool checkpointExists , uint64 checkpointTime , uint192 checkpointValue ) = _rocketNetworkSnapshotsTime.latest (_key);
167167 require (! _mustExist || checkpointExists, "Snapshot does not exist " );
168168 if (! checkpointExists) return 0 ;
@@ -178,6 +178,7 @@ contract RocketNetworkRevenues is RocketBase, RocketNetworkRevenuesInterface {
178178 uint256 currentAccum = uint256 (checkpointValue) + (valueAtTime * durationSinceCheckpoint);
179179 // Calculate the accumulator at _sinceTime
180180 (checkpointExists, checkpointTime, checkpointValue) = _rocketNetworkSnapshotsTime.lookupCheckpoint (_key, uint64 (_sinceTime));
181+ require (! _mustExist || checkpointExists, "Snapshot does not exist " );
181182 valueKey = bytes32 (uint256 (_key) + checkpointTime);
182183 valueAtTime = getUint (valueKey);
183184 durationSinceCheckpoint = (_sinceTime - checkpointTime);
0 commit comments