Skip to content

Commit d59d62b

Browse files
committed
refactor: remove error
1 parent de4e765 commit d59d62b

File tree

3 files changed

+5
-33
lines changed

3 files changed

+5
-33
lines changed

src/adapters/WstEthChainlinkAdapter.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ contract WstEthChainlinkAdapter is AggregatorV3Interface {
3434

3535
function latestRoundData() public view returns (uint80, int256, uint256, uint256, uint80) {
3636
uint256 answer = ST_ETH.getPooledEthByShares(10 ** decimals);
37-
require(answer <= uint256(type(int256).max), ErrorsLib.OVERFLOW);
3837
return (0, int256(answer), 0, 0, 0);
3938
}
4039
}

src/libraries/ErrorsLib.sol

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,4 @@ library ErrorsLib {
1717

1818
/// @notice Thrown when the zero address is passed as argument.
1919
string constant ZERO_ADDRESS = "zero address";
20-
21-
/// @notice Thrown when the computation will overflow.
22-
string constant OVERFLOW = "overflow";
2320
}

test/WstEthChainlinkAdapterTest.sol

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,20 @@ contract WstEthChainlinkAdapterTest is Test {
1616
oracle = new WstEthChainlinkAdapter(address(ST_ETH));
1717
}
1818

19-
function testLatestRoundDataOverflow(uint256 ethByShares) public {
20-
ethByShares = bound(ethByShares, uint256(type(int256).max) + 1, type(uint256).max);
21-
22-
vm.mockCall(
23-
address(ST_ETH),
24-
abi.encodeWithSelector(ST_ETH.getPooledEthByShares.selector, 10 ** 18),
25-
abi.encode(ethByShares)
26-
);
27-
vm.expectRevert(bytes(ErrorsLib.OVERFLOW));
28-
oracle.latestRoundData();
29-
}
30-
3119
function testDecimals() public {
3220
assertEq(oracle.decimals(), uint8(18));
3321
}
3422

23+
function testDescription() public {
24+
assertEq(oracle.description(), "wstETH/ETH exchange rate");
25+
}
26+
27+
3528
function testDeployZeroAddress() public {
3629
vm.expectRevert(bytes(ErrorsLib.ZERO_ADDRESS));
3730
new WstEthChainlinkAdapter(address(0));
3831
}
3932

40-
function testDescription() public {
41-
assertEq(oracle.description(), "wstETH/ETH exchange rate");
42-
}
43-
4433
function testReverts() public {
4534
vm.expectRevert();
4635
oracle.version();
@@ -59,19 +48,6 @@ contract WstEthChainlinkAdapterTest is Test {
5948
assertEq(answeredInRound, 0);
6049
}
6150

62-
function testLatestRoundDataNoOverflow(uint256 ethByShares) public {
63-
ethByShares = bound(ethByShares, 0, uint256(type(int256).max));
64-
65-
vm.mockCall(
66-
address(ST_ETH),
67-
abi.encodeWithSelector(ST_ETH.getPooledEthByShares.selector, 10 ** 18),
68-
abi.encode(ethByShares)
69-
);
70-
71-
(, int256 answer,,,) = oracle.latestRoundData();
72-
assertEq(uint256(answer), ethByShares);
73-
}
74-
7551
function testLatestRoundDataBounds() public {
7652
(, int256 answer,,,) = oracle.latestRoundData();
7753
assertGe(uint256(answer), 1154690031824824994); // Exchange rate queried at block 19070943

0 commit comments

Comments
 (0)