Skip to content

Commit

Permalink
add comment to latestAnswer calc
Browse files Browse the repository at this point in the history
  • Loading branch information
kyzia551 committed Aug 14, 2024
1 parent 09d6ec2 commit 1ad079d
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,11 @@ abstract contract Stata4626Upgradable is ERC4626Upgradeable, IStata4626 {
) public returns (uint256) {
// TODO: add tests
Stata4626Storage storage $ = _getStata4626Storage();
IERC20Permit asset = IERC20Permit(depositToAave ? asset() : address($._aToken));
IERC20Permit assetToDeposit = IERC20Permit(depositToAave ? asset() : address($._aToken));

try asset.permit(_msgSender(), address(this), assets, deadline, sig.v, sig.r, sig.s) {} catch {}
try
assetToDeposit.permit(_msgSender(), address(this), assets, deadline, sig.v, sig.r, sig.s)
{} catch {}

return depositToAave ? deposit(assets, receiver) : depositATokens(assets, receiver);
}
Expand Down Expand Up @@ -166,6 +168,7 @@ abstract contract Stata4626Upgradable is ERC4626Upgradeable, IStata4626 {
function latestAnswer() external view returns (int256) {
uint256 aTokenUnderlyingAssetPrice = IAaveOracle(POOL_ADDRESSES_PROVIDER.getPriceOracle())
.getAssetPrice(asset());
// aTokenUnderlyingAssetPrice * rate / RAY
return int256(aTokenUnderlyingAssetPrice.mulDiv(_rate(), RAY, Math.Rounding.Floor));
}

Expand Down

0 comments on commit 1ad079d

Please sign in to comment.