diff --git a/.gitmodules b/.gitmodules index 57561256..c01b3804 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,6 +10,3 @@ [submodule "lib/openzeppelin-contracts-upgradeable"] path = lib/openzeppelin-contracts-upgradeable url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable -[submodule "lib/euler-price-oracle"] - path = lib/euler-price-oracle - url = https://github.com/euler-xyz/euler-price-oracle diff --git a/lib/euler-price-oracle b/lib/euler-price-oracle deleted file mode 160000 index c4074ab7..00000000 --- a/lib/euler-price-oracle +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c4074ab7a7aa0c6ffbc555391d9f0bfe1ee5fd6f diff --git a/src/interfaces/external/aave/IAaveV3.sol b/src/interfaces/external/aave/IAaveV3.sol index e4051caa..2287cf4c 100644 --- a/src/interfaces/external/aave/IAaveV3.sol +++ b/src/interfaces/external/aave/IAaveV3.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0 pragma solidity >=0.8.20; -import {IERC20} from "openzeppelin-contracts-upgradeable/token/ERC20/extensions/ERC4626Upgradeable.sol"; +import {IERC20} from "openzeppelin-contracts/token/ERC20/IERC20.sol"; import {DataTypes} from "./lib.sol"; interface IScaledBalanceToken { @@ -45,7 +45,9 @@ interface IAaveIncentives { * @dev Returns list of reward token addresses for particular aToken. * */ - function getRewardsByAsset(address asset) external view returns (address[] memory); + function getRewardsByAsset( + address asset + ) external view returns (address[] memory); /** * @dev Returns list of reward tokens for all markets. @@ -57,21 +59,44 @@ interface IAaveIncentives { * @dev Claim all rewards for specified assets for user. * */ - function claimAllRewardsOnBehalf(address[] memory assets, address user, address to) + function claimAllRewardsOnBehalf( + address[] memory assets, + address user, + address to + ) external returns (address[] memory rewardsList, uint256[] memory claimedAmount); } // Aave lending pool interface interface ILendingPool { - function supply(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) external; - - function withdraw(address asset, uint256 amount, address to) external returns (uint256); - - function repay(address asset, uint256 amount, uint256 rateMode, address onBehalfOf) external returns (uint256); + function supply( + address asset, + uint256 amount, + address onBehalfOf, + uint16 referralCode + ) external; - function borrow(address asset, uint256 amount, uint256 interestRateMode, uint16 referralCode, address onBehalfOf) - external; + function withdraw( + address asset, + uint256 amount, + address to + ) external returns (uint256); + + function repay( + address asset, + uint256 amount, + uint256 rateMode, + address onBehalfOf + ) external returns (uint256); + + function borrow( + address asset, + uint256 amount, + uint256 interestRateMode, + uint16 referralCode, + address onBehalfOf + ) external; function flashLoan( address receiverAddress, @@ -83,11 +108,16 @@ interface ILendingPool { uint16 referralCode ) external; - function setUserUseReserveAsCollateral(address asset, bool useAsCollateral) external; + function setUserUseReserveAsCollateral( + address asset, + bool useAsCollateral + ) external; function setUserEMode(uint8 category) external; - function getEModeCategoryData(uint8 id) external returns (DataTypes.EModeData memory emodeData); + function getEModeCategoryData( + uint8 id + ) external returns (DataTypes.EModeData memory emodeData); function getUserEMode(address user) external returns (uint256); @@ -97,17 +127,27 @@ interface ILendingPool { * @return The state of the reserve * */ - function getReserveData(address asset) external view returns (DataTypes.ReserveData2 memory); + function getReserveData( + address asset + ) external view returns (DataTypes.ReserveData2 memory); - function getReserveNormalizedIncome(address asset) external view returns (uint256); + function getReserveNormalizedIncome( + address asset + ) external view returns (uint256); } // Aave protocol data provider interface IProtocolDataProvider { - function getReserveTokensAddresses(address asset) + function getReserveTokensAddresses( + address asset + ) external view - returns (address aTokenAddress, address stableDebtTokenAddress, address variableDebtTokenAddress); + returns ( + address aTokenAddress, + address stableDebtTokenAddress, + address variableDebtTokenAddress + ); } interface IFlashLoanReceiver { @@ -130,7 +170,10 @@ interface IFlashLoanReceiver { bytes calldata params ) external returns (bool); - function ADDRESSES_PROVIDER() external view returns (IPoolAddressesProvider); + function ADDRESSES_PROVIDER() + external + view + returns (IPoolAddressesProvider); function POOL() external view returns (ILendingPool); } @@ -173,7 +216,10 @@ interface IPoolAddressesProvider { * @param id The id * @param newImplementationAddress The address of the new implementation */ - function setAddressAsProxy(bytes32 id, address newImplementationAddress) external; + function setAddressAsProxy( + bytes32 id, + address newImplementationAddress + ) external; /** * @notice Sets an address for an id replacing the address saved in the addresses map. diff --git a/src/peripheral/oracles/lib/Errors.sol b/src/lib/Errors.sol similarity index 100% rename from src/peripheral/oracles/lib/Errors.sol rename to src/lib/Errors.sol diff --git a/src/peripheral/oracles/lib/ScaleUtils.sol b/src/lib/ScaleUtils.sol similarity index 98% rename from src/peripheral/oracles/lib/ScaleUtils.sol rename to src/lib/ScaleUtils.sol index ea5613c5..8793d749 100644 --- a/src/peripheral/oracles/lib/ScaleUtils.sol +++ b/src/lib/ScaleUtils.sol @@ -2,7 +2,7 @@ pragma solidity 0.8.23; import {FixedPointMathLib} from "@solady/utils/FixedPointMathLib.sol"; -import {Errors} from "src/lib/Errors.sol"; +import {Errors} from "./Errors.sol"; type Scale is uint256; diff --git a/src/peripheral/oracles/adapter/AaveV3Oracle.sol b/src/peripheral/oracles/adapter/AaveV3Oracle.sol index 12144c57..2e30d52f 100644 --- a/src/peripheral/oracles/adapter/AaveV3Oracle.sol +++ b/src/peripheral/oracles/adapter/AaveV3Oracle.sol @@ -3,7 +3,7 @@ pragma solidity ^0.8.23; -import {BaseAdapter, Errors, IPriceOracle} from "euler-price-oracle/adapter/BaseAdapter.sol"; +import {BaseAdapter, Errors, IPriceOracle} from "./BaseAdapter.sol"; import {IAToken} from "src/interfaces/external/aave/IAaveV3.sol"; /// @title AaveV3 Oracle diff --git a/src/peripheral/oracles/adapter/BaseAdapter.sol b/src/peripheral/oracles/adapter/BaseAdapter.sol index 136abeeb..237815fd 100644 --- a/src/peripheral/oracles/adapter/BaseAdapter.sol +++ b/src/peripheral/oracles/adapter/BaseAdapter.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-or-later -pragma solidity 0.8.23; +pragma solidity 0.8.25; -import {IERC20} from "forge-std/interfaces/IERC20.sol"; +import {IERC20} from "openzeppelin-contracts/token/ERC20/IERC20.sol"; import {IPriceOracle} from "src/interfaces/IPriceOracle.sol"; import {Errors} from "src/lib/Errors.sol"; @@ -11,13 +11,21 @@ import {Errors} from "src/lib/Errors.sol"; /// @notice Abstract adapter with virtual bid/ask pricing. abstract contract BaseAdapter is IPriceOracle { /// @inheritdoc IPriceOracle - function getQuote(uint256 inAmount, address base, address quote) external view returns (uint256) { + function getQuote( + uint256 inAmount, + address base, + address quote + ) external view returns (uint256) { return _getQuote(inAmount, base, quote); } /// @inheritdoc IPriceOracle /// @dev Does not support true bid/ask pricing. - function getQuotes(uint256 inAmount, address base, address quote) external view returns (uint256, uint256) { + function getQuotes( + uint256 inAmount, + address base, + address quote + ) external view returns (uint256, uint256) { uint256 outAmount = _getQuote(inAmount, base, quote); return (outAmount, outAmount); } @@ -30,11 +38,17 @@ abstract contract BaseAdapter is IPriceOracle { /// - a contract that does not implement `decimals()`. /// @return The decimals of the asset. function _getDecimals(address asset) internal view returns (uint8) { - (bool success, bytes memory data) = asset.staticcall(abi.encodeCall(IERC20.decimals, ())); + (bool success, bytes memory data) = asset.staticcall( + abi.encodeCall(IERC20.decimals, ()) + ); return success && data.length == 32 ? abi.decode(data, (uint8)) : 18; } /// @notice Return the quote for the given price query. /// @dev Must be overridden in the inheriting contract. - function _getQuote(uint256, address, address) internal view virtual returns (uint256); + function _getQuote( + uint256, + address, + address + ) internal view virtual returns (uint256); } diff --git a/src/peripheral/oracles/adapter/CrossOracle.sol b/src/peripheral/oracles/adapter/CrossOracle.sol index 70d0280d..22af10a7 100644 --- a/src/peripheral/oracles/adapter/CrossOracle.sol +++ b/src/peripheral/oracles/adapter/CrossOracle.sol @@ -1,9 +1,8 @@ // SPDX-License-Identifier: GPL-2.0-or-later -pragma solidity ^0.8.23; +pragma solidity ^0.8.25; -import {Errors, BaseAdapter} from "euler-price-oracle/adapter/BaseAdapter.sol"; -import {IPriceOracle} from "euler-price-oracle/interfaces/IPriceOracle.sol"; -import {ScaleUtils} from "euler-price-oracle/lib/ScaleUtils.sol"; +import {Errors, BaseAdapter, IPriceOracle} from "./BaseAdapter.sol"; +import {ScaleUtils} from "src/lib/ScaleUtils.sol"; struct OracleStep { address base; diff --git a/src/peripheral/oracles/adapter/PendleLpOracle.sol b/src/peripheral/oracles/adapter/PendleLpOracle.sol index 988a1c86..da16030b 100644 --- a/src/peripheral/oracles/adapter/PendleLpOracle.sol +++ b/src/peripheral/oracles/adapter/PendleLpOracle.sol @@ -3,8 +3,8 @@ pragma solidity ^0.8.23; -import {BaseAdapter, Errors, IPriceOracle} from "euler-price-oracle/adapter/BaseAdapter.sol"; -import {ScaleUtils, Scale} from "euler-price-oracle/lib/ScaleUtils.sol"; +import {BaseAdapter, Errors, IPriceOracle} from "./BaseAdapter.sol"; +import {ScaleUtils, Scale} from "src/lib/ScaleUtils.sol"; interface IPendleMarket { function readTokens() diff --git a/src/peripheral/oracles/adapter/UniswapV3Oracle.sol b/src/peripheral/oracles/adapter/UniswapV3Oracle.sol index fbb3fd87..85b1c62a 100644 --- a/src/peripheral/oracles/adapter/UniswapV3Oracle.sol +++ b/src/peripheral/oracles/adapter/UniswapV3Oracle.sol @@ -4,7 +4,7 @@ pragma solidity 0.8.23; import {IUniswapV3Pool} from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol"; import {IUniswapV3Factory} from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Factory.sol"; import {OracleLibrary} from "@uniswap/v3-periphery/contracts/libraries/OracleLibrary.sol"; -import {BaseAdapter, Errors, IPriceOracle} from "euler-price-oracle/adapter/BaseAdapter.sol"; +import {BaseAdapter, Errors, IPriceOracle} from "./BaseAdapter.sol"; /// @title UniswapV3Oracle /// @custom:security-contact security@euler.xyz