Skip to content

Commit

Permalink
fix: format fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghadi8 committed Sep 20, 2024
1 parent 71918d9 commit 1cd124a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
29 changes: 14 additions & 15 deletions src/libraries/OracleLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pragma solidity ^0.8.18;

import {AggregatorV3Interface} from "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";


/*
* @title OracleLib
* @author Ghadi Mhawej
Expand All @@ -15,20 +14,20 @@ library OracleLib {
error OracleLib__StalePrice();

uint256 private constant TIMEOUT = 3 hours;
function staleCheckLatestRoundData(AggregatorV3Interface priceFeed) public view returns(uint80, int256, uint256, uint256, uint80) {
(
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
) = priceFeed.latestRoundData();

uint256 secondsSinceLastUpdate = block.timestamp - updatedAt;
if (secondsSinceLastUpdate > TIMEOUT) {
revert OracleLib__StalePrice();
}
function staleCheckLatestRoundData(AggregatorV3Interface priceFeed)
public
view
returns (uint80, int256, uint256, uint256, uint80)
{
(uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound) =
priceFeed.latestRoundData();

return (roundId, answer, startedAt, updatedAt, answeredInRound);
uint256 secondsSinceLastUpdate = block.timestamp - updatedAt;
if (secondsSinceLastUpdate > TIMEOUT) {
revert OracleLib__StalePrice();
}

return (roundId, answer, startedAt, updatedAt, answeredInRound);
}
}
}
2 changes: 1 addition & 1 deletion test/fuzz/Handler.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ contract Handler is Test {
weth = ERC20Mock(collateralTokens[0]);
wbtc = ERC20Mock(collateralTokens[1]);

ethUsdPriceFeed = MockV3Aggregator(engine.getPriceFeed(address(weth)));
ethUsdPriceFeed = MockV3Aggregator(engine.getPriceFeed(address(weth)));
}

function depositCollateral(uint256 collateralSeed, uint256 amountCollateral) public {
Expand Down
1 change: 0 additions & 1 deletion test/fuzz/InvariantsTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,5 @@ contract InvariantsTest is StdInvariant, Test {
// Getter functions should never revert
function invariant_getterFunctionsShouldNeverRevert() public view {
engine.getCollateralTokens();

}
}

0 comments on commit 1cd124a

Please sign in to comment.