fix tests

This commit is contained in:
Jules Clown 2024-11-13 16:37:23 +01:00
parent bb34d0725f
commit 97b5e249ac
5 changed files with 11 additions and 9 deletions

View file

@ -120,9 +120,11 @@ contract SentimenterTest is Test {
}
function testContractUpgrade() public {
address newSent = address(new MockSentimenter());
sentimenter.upgradeTo(newSent);
uint256 sentiment = sentimenter.getSentiment();
assertEq(sentiment, 1234567890123456789, "should have been upgraded");
uint256 sentiment = sentimenter.getSentiment();
assertEq(sentiment, 1e18, "should have been upgraded");
address newSent = address(new MockSentimenter());
sentimenter.upgradeTo(newSent);
sentiment = sentimenter.getSentiment();
assertEq(sentiment, 0, "should have been upgraded");
}
}

View file

@ -136,7 +136,7 @@ contract SimulationsTest is UniswapTestBase, CSVManager {
vm.warp(timeBefore + 5 minutes);
}
function getPriceInHarb(uint160 sqrtPriceX96) internal returns (uint256 price) {
function getPriceInHarb(uint160 sqrtPriceX96) internal view returns (uint256 price) {
uint256 sqrtPrice = uint256(sqrtPriceX96);
if (token0isWeth) {

View file

@ -41,7 +41,7 @@ contract MockSentimenter is Initializable, UUPSUpgradeable {
}
function _authorizeUpgrade(address newImplementation) internal override onlyAdmin {}
function calculateSentiment(uint256 averageTaxRate, uint256 percentageStaked) public pure returns (uint256 sentimentValue) {
function calculateSentiment(uint256, uint256) public pure returns (uint256 sentimentValue) {
return 0;
}
@ -49,7 +49,7 @@ contract MockSentimenter is Initializable, UUPSUpgradeable {
/// @notice Computes the staker sentiment based on the proportion of the authorized stake that is currently staked.
/// @return sentiment A number between 0 and 200 indicating the market sentiment.
function getSentiment() external returns (uint256 sentiment) {
function getSentiment() external view returns (uint256 sentiment) {
uint256 percentageStaked = stake.getPercentageStaked();
uint256 averageTaxRate = stake.getAverageTaxRate();
sentiment = calculateSentiment(averageTaxRate, percentageStaked);