Skip to content

Commit 481aba9

Browse files
committed
fix: fuzz bounds, reorder docs
1 parent b91bff7 commit 481aba9

2 files changed

Lines changed: 15 additions & 15 deletions

File tree

src/contracts/interfaces/IScaledPriceAdapter.sol

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,31 @@ pragma solidity ^0.8.10;
33

44
interface IScaledPriceAdapter {
55
/**
6-
* @dev Direction and units used to scale latestAnswer to base decimals of 8.
7-
* @dev Loses price precision by log10(scaleFactor) when scaling down.
8-
* @return scaleUp Whether to scale up or down.
9-
* @return scaleFactor The units to scale by.
6+
* @dev Returns the feed decimals.
107
*/
11-
function scale() external view returns (bool scaleUp, uint256 scaleFactor);
8+
function decimals() external view returns (uint8);
129

1310
/**
14-
* @dev The decimals of price adapter.
11+
* @dev Returns the description of the feed.
1512
*/
16-
function decimals() external view returns (uint8);
13+
function description() external view returns (string memory);
1714

1815
/**
19-
* @dev Underlying chainlink price source.
16+
* @dev Scaled `latestAnswer` from chainlink price feed.
17+
* @dev Loses price precision by log10(scaleFactor) when scaling down.
2018
*/
21-
function source() external view returns (address);
19+
function latestAnswer() external view returns (int256);
2220

2321
/**
24-
* @dev Description of price adapter.
22+
* @dev Direction and units used to scale latestAnswer to base decimals of 8.
23+
* @dev Loses price precision by log10(scaleFactor) when scaling down.
24+
* @return scaleUp Whether to scale up or down.
25+
* @return scaleFactor The units to scale by.
2526
*/
26-
function description() external view returns (string memory);
27+
function scale() external view returns (bool scaleUp, uint256 scaleFactor);
2728

2829
/**
29-
* @dev Scaled `latestAnswer` from chainlink price feed.
30-
* @dev Loses price precision by log10(scaleFactor) when scaling down.
30+
* @dev Underlying chainlink price feed.
3131
*/
32-
function latestAnswer() external view returns (int256);
32+
function source() external view returns (address);
3333
}

tests/extensions/price-adaptors/ScaledPriceAdapter.t.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ contract ScaledPriceAdapterTests is TestnetProcedures {
2121

2222
function test_fuzz_adapter(uint256 sourceDecimals, int256 price) public {
2323
sourceDecimals = bound(sourceDecimals, 1, 36);
24-
price = bound(price, 1, int256(10 ** sourceDecimals));
24+
price = bound(price, 0, int256(10 ** (10 + sourceDecimals)));
2525
address source = address(new MockAggregatorMetadata(price, uint8(sourceDecimals)));
2626
ScaledPriceAdapter adapter = new ScaledPriceAdapter(source);
2727

0 commit comments

Comments
 (0)