Skip to content

Commit f8d1010

Browse files
committed
fix: add missing serialize() and other nits
1 parent 951b716 commit f8d1010

17 files changed

+42
-24
lines changed

contracts/oracles/BoundedPriceFeed.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ contract BoundedPriceFeed is IPriceFeed, SanityCheckTrait, PriceFeedValidationTr
5555
}
5656

5757
/// @notice Serialized price feed parameters
58-
function serialize() external view returns (bytes memory) {
58+
function serialize() external view override returns (bytes memory) {
5959
return abi.encode(upperBound);
6060
}
6161

contracts/oracles/CompositePriceFeed.sol

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ contract CompositePriceFeed is IPriceFeed, PriceFeedValidationTrait, SanityCheck
6464
return string.concat(_descriptionTicker.fromSmallString(), " composite price feed"); // U:[CPF-2]
6565
}
6666

67+
/// @notice Empty state serialization
68+
function serialize() external pure override returns (bytes memory) {}
69+
6770
/// @notice Returns the USD price of the target asset, computed as target/base price times base/USD price
6871
function latestRoundData() external view override returns (uint80, int256 answer, uint256, uint256, uint80) {
6972
answer = _getValidatedPrice(priceFeed0, stalenessPeriod0, skipCheck0); // U:[CPF-3]

contracts/oracles/LPPriceFeed.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ abstract contract LPPriceFeed is ILPPriceFeed, Ownable, SanityCheckTrait, PriceF
6464
}
6565

6666
/// @notice Serialized price feed parameters
67-
function serialize() public view virtual returns (bytes memory) {
67+
function serialize() public view virtual override returns (bytes memory) {
6868
uint256 lb = lowerBound;
6969
return abi.encode(lpToken, lpContract, lb, _calcUpperBound(lb));
7070
}

contracts/oracles/ZeroPriceFeed.sol

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ contract ZeroPriceFeed is IPriceFeed {
1515
string public constant override description = "Zero price feed"; // U:[ZPF-1]
1616
bool public constant override skipPriceCheck = true; // U:[ZPF-1]
1717

18+
/// @notice Empty state serialization
19+
function serialize() external pure override returns (bytes memory) {}
20+
1821
/// @notice Returns zero price
1922
function latestRoundData() external pure override returns (uint80, int256, uint256, uint256, uint80) {
2023
return (0, 0, 0, 0, 0); // U:[ZPF-2]

contracts/oracles/balancer/BPTStablePriceFeed.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ contract BPTStablePriceFeed is LPPriceFeed {
3636
uint32 public immutable stalenessPeriod4;
3737
bool public immutable skipCheck4;
3838

39-
constructor(address _owner, uint256 lowerBound, address _balancerPool, PriceFeedParams[5] memory priceFeeds)
39+
constructor(address _owner, uint256 _lowerBound, address _balancerPool, PriceFeedParams[5] memory priceFeeds)
4040
LPPriceFeed(_owner, _balancerPool, _balancerPool) // U:[BAL-S-1]
4141
nonZeroAddress(priceFeeds[0].priceFeed) // U:[BAL-S-2]
4242
nonZeroAddress(priceFeeds[1].priceFeed) // U:[BAL-S-2]
@@ -61,7 +61,7 @@ contract BPTStablePriceFeed is LPPriceFeed {
6161
skipCheck3 = numAssets > 3 ? _validatePriceFeed(priceFeed3, stalenessPeriod3) : false;
6262
skipCheck4 = numAssets > 4 ? _validatePriceFeed(priceFeed4, stalenessPeriod4) : false;
6363

64-
_setLimiter(lowerBound); // U:[BAL-S-1]
64+
_setLimiter(_lowerBound); // U:[BAL-S-1]
6565
}
6666

6767
function getAggregatePrice() public view override returns (int256 answer) {

contracts/oracles/balancer/BPTWeightedPriceFeed.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ contract BPTWeightedPriceFeed is LPPriceFeed {
9696
uint256 immutable scale6;
9797
uint256 immutable scale7;
9898

99-
constructor(address _owner, uint256 lowerBound, address _vault, address _pool, PriceFeedParams[] memory priceFeeds)
99+
constructor(address _owner, uint256 _lowerBound, address _vault, address _pool, PriceFeedParams[] memory priceFeeds)
100100
LPPriceFeed(_owner, _pool, _pool) // U:[BAL-W-1]
101101
nonZeroAddress(_vault) // U:[BAL-W-1]
102102
nonZeroAddress(priceFeeds[0].priceFeed) // U:[BAL-W-2]
@@ -164,7 +164,7 @@ contract BPTWeightedPriceFeed is LPPriceFeed {
164164
skipCheck6 = numAssets >= 7 ? _validatePriceFeed(priceFeed6, stalenessPeriod6) : false;
165165
skipCheck7 = numAssets >= 8 ? _validatePriceFeed(priceFeed7, stalenessPeriod7) : false;
166166

167-
_setLimiter(lowerBound); // U:[BAL-W-1]
167+
_setLimiter(_lowerBound); // U:[BAL-W-1]
168168
}
169169

170170
/// @notice Serialized price feed parameters

contracts/oracles/curve/CurveCryptoLPPriceFeed.sol

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@ contract CurveCryptoLPPriceFeed is LPPriceFeed {
3434
uint32 public immutable stalenessPeriod2;
3535
bool public immutable skipCheck2;
3636

37-
constructor(address _owner, uint256 lowerBound, address _token, address _pool, PriceFeedParams[3] memory priceFeeds)
37+
constructor(
38+
address _owner,
39+
uint256 _lowerBound,
40+
address _token,
41+
address _pool,
42+
PriceFeedParams[3] memory priceFeeds
43+
)
3844
LPPriceFeed(_owner, _token, _pool) // U:[CRV-C-1]
3945
nonZeroAddress(priceFeeds[0].priceFeed) // U:[CRV-C-2]
4046
nonZeroAddress(priceFeeds[1].priceFeed) // U:[CRV-C-2]
@@ -53,7 +59,7 @@ contract CurveCryptoLPPriceFeed is LPPriceFeed {
5359
skipCheck1 = _validatePriceFeed(priceFeed1, stalenessPeriod1);
5460
skipCheck2 = nCoins == 3 ? _validatePriceFeed(priceFeed2, stalenessPeriod2) : false;
5561

56-
_setLimiter(lowerBound); // U:[CRV-C-1]
62+
_setLimiter(_lowerBound); // U:[CRV-C-1]
5763
}
5864

5965
function getAggregatePrice() public view override returns (int256 answer) {

contracts/oracles/curve/CurveStableLPPriceFeed.sol

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@ contract CurveStableLPPriceFeed is LPPriceFeed {
3333
uint32 public immutable stalenessPeriod3;
3434
bool public immutable skipCheck3;
3535

36-
constructor(address _owner, uint256 lowerBound, address _token, address _pool, PriceFeedParams[4] memory priceFeeds)
36+
constructor(
37+
address _owner,
38+
uint256 _lowerBound,
39+
address _token,
40+
address _pool,
41+
PriceFeedParams[4] memory priceFeeds
42+
)
3743
LPPriceFeed(_owner, _token, _pool) // U:[CRV-S-1]
3844
nonZeroAddress(priceFeeds[0].priceFeed) // U:[CRV-S-2]
3945
nonZeroAddress(priceFeeds[1].priceFeed) // U:[CRV-S-2]
@@ -55,7 +61,7 @@ contract CurveStableLPPriceFeed is LPPriceFeed {
5561
skipCheck2 = nCoins > 2 ? _validatePriceFeed(priceFeed2, stalenessPeriod2) : false;
5662
skipCheck3 = nCoins > 3 ? _validatePriceFeed(priceFeed3, stalenessPeriod3) : false;
5763

58-
_setLimiter(lowerBound); // U:[CRV-S-1]
64+
_setLimiter(_lowerBound); // U:[CRV-S-1]
5965
}
6066

6167
function getAggregatePrice() public view override returns (int256 answer) {

contracts/oracles/curve/CurveUSDPriceFeed.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ contract CurveUSDPriceFeed is SingleAssetLPPriceFeed {
1717

1818
constructor(
1919
address _owner,
20-
uint256 lowerBound,
20+
uint256 _lowerBound,
2121
address _crvUSD,
2222
address _pool,
2323
address _priceFeed,
2424
uint32 _stalenessPeriod
2525
)
2626
SingleAssetLPPriceFeed(_owner, _crvUSD, _pool, _priceFeed, _stalenessPeriod) // U:[CRV-D-1]
2727
{
28-
_setLimiter(lowerBound); // U:[CRV-D-1]
28+
_setLimiter(_lowerBound); // U:[CRV-D-1]
2929
}
3030

3131
function getLPExchangeRate() public view override returns (uint256) {

contracts/oracles/erc4626/ERC4626PriceFeed.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ contract ERC4626PriceFeed is SingleAssetLPPriceFeed {
1818
/// @dev Amount of underlying asset comprising a single unit (accounting for decimals)
1919
uint256 immutable _assetUnit;
2020

21-
constructor(address _owner, uint256 lowerBound, address _vault, address _priceFeed, uint32 _stalenessPeriod)
21+
constructor(address _owner, uint256 _lowerBound, address _vault, address _priceFeed, uint32 _stalenessPeriod)
2222
SingleAssetLPPriceFeed(_owner, _vault, _vault, _priceFeed, _stalenessPeriod) // U:[TV-1]
2323
{
2424
_shareUnit = 10 ** IERC4626(_vault).decimals();
2525
_assetUnit = 10 ** ERC20(IERC4626(_vault).asset()).decimals();
26-
_setLimiter(lowerBound); // U:[TV-1]
26+
_setLimiter(_lowerBound); // U:[TV-1]
2727
}
2828

2929
function getLPExchangeRate() public view override returns (uint256) {

0 commit comments

Comments
 (0)