diff --git a/onchain/script/DeployScript.sol b/onchain/script/DeployScript.sol index c29096b..d0da04d 100644 --- a/onchain/script/DeployScript.sol +++ b/onchain/script/DeployScript.sol @@ -26,7 +26,7 @@ contract DeployScript is Script { string memory seedPhrase = vm.readFile(".secret"); uint256 privateKey = vm.deriveKey(seedPhrase, 0); vm.startBroadcast(privateKey); - address sender = vm.addr(privateKey); + //address sender = vm.addr(privateKey); TwabController tc; if (twabc == address(0)) { diff --git a/onchain/src/Sentimenter.sol b/onchain/src/Sentimenter.sol index 4a45c00..615e97c 100644 --- a/onchain/src/Sentimenter.sol +++ b/onchain/src/Sentimenter.sol @@ -69,7 +69,7 @@ contract Sentimenter 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); diff --git a/onchain/test/Sentimenter.t.sol b/onchain/test/Sentimenter.t.sol index 571f60b..2470157 100644 --- a/onchain/test/Sentimenter.t.sol +++ b/onchain/test/Sentimenter.t.sol @@ -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"); } } diff --git a/onchain/test/Simulations.t.sol b/onchain/test/Simulations.t.sol index 33a344f..7b32bd8 100644 --- a/onchain/test/Simulations.t.sol +++ b/onchain/test/Simulations.t.sol @@ -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) { diff --git a/onchain/test/mocks/MockSentimenter.sol b/onchain/test/mocks/MockSentimenter.sol index 3e59553..9c39ea7 100644 --- a/onchain/test/mocks/MockSentimenter.sol +++ b/onchain/test/mocks/MockSentimenter.sol @@ -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);