Skip to content

Commit

Permalink
change latestAnswer calculation logic
Browse files Browse the repository at this point in the history
  • Loading branch information
kyzia551 committed Aug 13, 2024
1 parent 863485f commit 6034a94
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 19 deletions.
4 changes: 3 additions & 1 deletion remappings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ aave-v3-core/=src/core/
aave-v3-periphery/=src/periphery/
solidity-utils/=lib/solidity-utils/src/
forge-std/=lib/forge-std/src/
ds-test/=lib/forge-std/lib/ds-test/src/
ds-test/=lib/forge-std/lib/ds-test/src/
openzeppelin-contracts-upgradeable/=lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/
openzeppelin-contracts/=lib/solidity-utils/lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/
2 changes: 1 addition & 1 deletion scripts/misc/DeployAaveV3MarketBatchedBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ abstract contract DeployAaveV3MarketBatchedBase is DeployUtils, MarketInput, Scr
metadataReporter.writeJsonReportMarket(report);
}

function _loadWarnings(MarketConfig memory config, DeployFlags memory flags) internal view {
function _loadWarnings(MarketConfig memory config, DeployFlags memory flags) internal pure {
if (config.paraswapAugustusRegistry == address(0)) {
console.log(
'Warning: Paraswap Adapters will be skipped at deployment due missing config.paraswapAugustusRegistry'
Expand Down
13 changes: 5 additions & 8 deletions src/periphery/contracts/static-a-token/Stata4626.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ import {ERC20Upgradeable} from 'openzeppelin-contracts-upgradeable/contracts/tok
import {ERC20PermitUpgradeable} from 'openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/ERC20PermitUpgradeable.sol';
import {ERC20PausableUpgradeable} from 'openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/ERC20PausableUpgradeable.sol';
import {ERC4626Upgradeable, Math, IERC4626} from 'openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/ERC4626Upgradeable.sol';
import {IERC20} from 'openzeppelin-contracts/contracts/interfaces/IERC20.sol';
import {SafeERC20} from 'openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol';
import {SafeERC20, IERC20} from 'openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol';

import {IPool} from '../../../core/contracts/interfaces/IPool.sol';
import {IPoolAddressesProvider} from '../../../core/contracts/interfaces/IPoolAddressesProvider.sol';
import {IPool, IPoolAddressesProvider} from '../../../core/contracts/interfaces/IPool.sol';
import {IAaveOracle} from '../../../core/contracts/interfaces/IAaveOracle.sol';
import {DataTypes, ReserveConfiguration} from '../../../core/contracts/protocol/libraries/configuration/ReserveConfiguration.sol';
import {IACLManager} from '../../../core/contracts/interfaces/IACLManager.sol';
Expand All @@ -27,7 +25,6 @@ import {IStata4626} from './interfaces/IStata4626.sol';
* @author BGD labs
*/
contract Stata4626 is
ERC20Upgradeable,
ERC20PermitUpgradeable,
ERC20PausableUpgradeable,
ERC4626Upgradeable,
Expand Down Expand Up @@ -187,7 +184,7 @@ contract Stata4626 is
function latestAnswer() external view returns (int256) {
uint256 aTokenUnderlyingAssetPrice = IAaveOracle(POOL_ADDRESSES_PROVIDER.getPriceOracle())
.getAssetPrice(asset());
return int256(convertToAssets(aTokenUnderlyingAssetPrice));
return int256(aTokenUnderlyingAssetPrice.rayMulRoundDown(_rate()));
}

function _deposit(
Expand Down Expand Up @@ -293,8 +290,8 @@ contract Stata4626 is
address from,
address to,
uint256 amount
) internal virtual override(ERC20Upgradeable, ERC20PausableUpgradeable) whenNotPaused {
super._update(from, to, amount);
) internal virtual override(ERC20PausableUpgradeable, ERC20Upgradeable) whenNotPaused {
ERC20PausableUpgradeable._update(from, to, amount);
}

function _rate() internal view returns (uint256) {
Expand Down
2 changes: 1 addition & 1 deletion tests/DeploymentsGasLimits.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ contract DeploymentsGasLimits is BatchTestProcedures {
);
}

function testCheckInitCodeSizeBatchs() public view {
function testCheckInitCodeSizeBatches() public pure {
uint16 maxInitCodeSize = 49152;

console.log('AaveV3SetupBatch', type(AaveV3SetupBatch).creationCode.length);
Expand Down
14 changes: 7 additions & 7 deletions tests/core/Pool.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -667,31 +667,31 @@ contract PoolTests is TestnetProcedures {
assertEq(50_000e6, virtualBalance);
}

function test_getFlashLoanLogic() public {
function test_getFlashLoanLogic() public view {
assertNotEq(pool.getFlashLoanLogic(), address(0));
}

function test_getBorrowLogic() public {
function test_getBorrowLogic() public view {
assertNotEq(pool.getBorrowLogic(), address(0));
}

function test_getBridgeLogic() public {
function test_getBridgeLogic() public view {
assertNotEq(pool.getBridgeLogic(), address(0));
}

function test_getEModeLogic() public {
function test_getEModeLogic() public view {
assertNotEq(pool.getEModeLogic(), address(0));
}

function test_getLiquidationLogic() public {
function test_getLiquidationLogic() public view {
assertNotEq(pool.getLiquidationLogic(), address(0));
}

function test_getPoolLogic() public {
function test_getPoolLogic() public view {
assertNotEq(pool.getPoolLogic(), address(0));
}

function test_getSupplyLogic() public {
function test_getSupplyLogic() public view {
assertNotEq(pool.getSupplyLogic(), address(0));
}

Expand Down
2 changes: 1 addition & 1 deletion tests/core/PoolConfigurator.upgradeabilty.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ contract PoolConfiguratorUpgradeabilityTests is TestnetProcedures {
initTestEnvironment();
}

function test_getConfiguratorLogic() public {
function test_getConfiguratorLogic() public view {
assertNotEq(contracts.poolConfiguratorProxy.getConfiguratorLogic(), address(0));
}

Expand Down

0 comments on commit 6034a94

Please sign in to comment.