Skip to content

Commit 01b3077

Browse files
perf: caching max_deposit_limit
CS-CURVE_SCRVUSD-005.DepositLimitModule.1
1 parent 9d904c0 commit 01b3077

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

contracts/DepositLimitModule.vy

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,13 +192,15 @@ def available_deposit_limit(receiver: address) -> uint256:
192192
@return uint256 Returns the maximum deposit limit if deposits are not paused,
193193
otherwise returns (self.max_deposit_limit - vault_balance).
194194
"""
195+
max_deposit_limit: uint256 = self.max_deposit_limit
196+
195197
if self.deposits_paused:
196198
return 0
197-
if self.max_deposit_limit == max_value(uint256):
199+
if max_deposit_limit == max_value(uint256):
198200
return max_value(uint256)
199201
else:
200202
vault_balance: uint256 = staticcall vault.totalAssets()
201-
if vault_balance >= self.max_deposit_limit:
203+
if vault_balance >= max_deposit_limit:
202204
return 0
203205
else:
204-
return self.max_deposit_limit - vault_balance
206+
return max_deposit_limit - vault_balance

0 commit comments

Comments
 (0)