Skip to content

Commit f49b4fe

Browse files
optimize .eulerAccount() calls
1 parent bb2a007 commit f49b4fe

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/EulerSwapPeriphery.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,11 +250,11 @@ contract EulerSwapPeriphery is IEulerSwapPeriphery {
250250

251251
function _getLimits(IEulerSwap es, bool asset0IsInput) internal view returns (uint256 inLimit, uint256 outLimit) {
252252
inLimit = outLimit = type(uint112).max;
253-
253+
address eulerAccount = es.eulerAccount();
254254
// Supply caps on input
255255
{
256256
IEVault vault = IEVault(asset0IsInput ? es.vault0() : es.vault1());
257-
uint256 maxDeposit = vault.debtOf(es.eulerAccount()) + vault.maxDeposit(es.eulerAccount());
257+
uint256 maxDeposit = vault.debtOf(eulerAccount) + vault.maxDeposit(eulerAccount);
258258
if (maxDeposit < inLimit) inLimit = maxDeposit;
259259
}
260260

@@ -276,7 +276,7 @@ contract EulerSwapPeriphery is IEulerSwapPeriphery {
276276
uint256 maxWithdraw = decodeCap(uint256(borrowCap));
277277
maxWithdraw = vault.totalBorrows() > maxWithdraw ? 0 : maxWithdraw - vault.totalBorrows();
278278
if (maxWithdraw > cash) maxWithdraw = cash;
279-
maxWithdraw += vault.convertToAssets(vault.balanceOf(es.eulerAccount()));
279+
maxWithdraw += vault.convertToAssets(vault.balanceOf(eulerAccount));
280280
if (maxWithdraw < outLimit) outLimit = maxWithdraw;
281281
}
282282
}

0 commit comments

Comments
 (0)