mirror of
https://github.com/Instadapp/dsa-resolvers-deprecated.git
synced 2024-07-29 22:38:16 +00:00
refactor: 💡 priceInMatic -> priceInEth, maticPrice -> ethPrice
This commit is contained in:
parent
a5cd9c18e7
commit
5ef106e62d
|
|
@ -109,7 +109,7 @@ contract Helpers is DSMath {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct TokenPrice {
|
struct TokenPrice {
|
||||||
uint256 priceInMatic;
|
uint256 priceInEth;
|
||||||
uint256 priceInUsd;
|
uint256 priceInUsd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -177,27 +177,27 @@ contract InstaAaveV2PowerResolver is Helpers {
|
||||||
function getTokensPrices(address[] calldata tokens)
|
function getTokensPrices(address[] calldata tokens)
|
||||||
external
|
external
|
||||||
view
|
view
|
||||||
returns (TokenPrice[] memory tokenPrices, uint256 maticPrice)
|
returns (TokenPrice[] memory tokenPrices, uint256 ethPrice)
|
||||||
{
|
{
|
||||||
AaveAddressProvider aaveAddressProvider =
|
AaveAddressProvider aaveAddressProvider =
|
||||||
AaveAddressProvider(getAaveAddressProvider());
|
AaveAddressProvider(getAaveAddressProvider());
|
||||||
uint256[] memory _tokenPrices =
|
uint256[] memory _tokenPrices =
|
||||||
AavePriceOracle(aaveAddressProvider.getPriceOracle())
|
AavePriceOracle(aaveAddressProvider.getPriceOracle())
|
||||||
.getAssetsPrices(tokens);
|
.getAssetsPrices(tokens);
|
||||||
maticPrice = uint256(
|
ethPrice = uint256(
|
||||||
ChainLinkInterface(getChainlinkMaticFeed()).latestAnswer()
|
ChainLinkInterface(getChainlinkMaticFeed()).latestAnswer()
|
||||||
);
|
);
|
||||||
tokenPrices = new TokenPrice[](_tokenPrices.length);
|
tokenPrices = new TokenPrice[](_tokenPrices.length);
|
||||||
for (uint256 i = 0; i < _tokenPrices.length; i++) {
|
for (uint256 i = 0; i < _tokenPrices.length; i++) {
|
||||||
tokenPrices[i] = TokenPrice(
|
tokenPrices[i] = TokenPrice(
|
||||||
_tokenPrices[i],
|
_tokenPrices[i],
|
||||||
wmul(_tokenPrices[i], uint256(maticPrice) * 10**10)
|
wmul(_tokenPrices[i], uint256(ethPrice) * 10**10)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMaticPrice() public view returns (uint256 maticPrice) {
|
function getEthPrice() public view returns (uint256 ethPrice) {
|
||||||
maticPrice = uint256(
|
ethPrice = uint256(
|
||||||
ChainLinkInterface(getChainlinkMaticFeed()).latestAnswer()
|
ChainLinkInterface(getChainlinkMaticFeed()).latestAnswer()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user