fix tests
This commit is contained in:
parent
bb34d0725f
commit
97b5e249ac
5 changed files with 11 additions and 9 deletions
|
|
@ -26,7 +26,7 @@ contract DeployScript is Script {
|
||||||
string memory seedPhrase = vm.readFile(".secret");
|
string memory seedPhrase = vm.readFile(".secret");
|
||||||
uint256 privateKey = vm.deriveKey(seedPhrase, 0);
|
uint256 privateKey = vm.deriveKey(seedPhrase, 0);
|
||||||
vm.startBroadcast(privateKey);
|
vm.startBroadcast(privateKey);
|
||||||
address sender = vm.addr(privateKey);
|
//address sender = vm.addr(privateKey);
|
||||||
|
|
||||||
TwabController tc;
|
TwabController tc;
|
||||||
if (twabc == address(0)) {
|
if (twabc == address(0)) {
|
||||||
|
|
|
||||||
|
|
@ -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.
|
/// @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.
|
/// @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 percentageStaked = stake.getPercentageStaked();
|
||||||
uint256 averageTaxRate = stake.getAverageTaxRate();
|
uint256 averageTaxRate = stake.getAverageTaxRate();
|
||||||
sentiment = calculateSentiment(averageTaxRate, percentageStaked);
|
sentiment = calculateSentiment(averageTaxRate, percentageStaked);
|
||||||
|
|
|
||||||
|
|
@ -120,9 +120,11 @@ contract SentimenterTest is Test {
|
||||||
}
|
}
|
||||||
|
|
||||||
function testContractUpgrade() public {
|
function testContractUpgrade() public {
|
||||||
address newSent = address(new MockSentimenter());
|
uint256 sentiment = sentimenter.getSentiment();
|
||||||
sentimenter.upgradeTo(newSent);
|
assertEq(sentiment, 1e18, "should have been upgraded");
|
||||||
uint256 sentiment = sentimenter.getSentiment();
|
address newSent = address(new MockSentimenter());
|
||||||
assertEq(sentiment, 1234567890123456789, "should have been upgraded");
|
sentimenter.upgradeTo(newSent);
|
||||||
|
sentiment = sentimenter.getSentiment();
|
||||||
|
assertEq(sentiment, 0, "should have been upgraded");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ contract SimulationsTest is UniswapTestBase, CSVManager {
|
||||||
vm.warp(timeBefore + 5 minutes);
|
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);
|
uint256 sqrtPrice = uint256(sqrtPriceX96);
|
||||||
|
|
||||||
if (token0isWeth) {
|
if (token0isWeth) {
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ contract MockSentimenter is Initializable, UUPSUpgradeable {
|
||||||
}
|
}
|
||||||
function _authorizeUpgrade(address newImplementation) internal override onlyAdmin {}
|
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;
|
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.
|
/// @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.
|
/// @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 percentageStaked = stake.getPercentageStaked();
|
||||||
uint256 averageTaxRate = stake.getAverageTaxRate();
|
uint256 averageTaxRate = stake.getAverageTaxRate();
|
||||||
sentiment = calculateSentiment(averageTaxRate, percentageStaked);
|
sentiment = calculateSentiment(averageTaxRate, percentageStaked);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue