Skip to content

Commit

Permalink
perf: caching max_deposit_limit
Browse files Browse the repository at this point in the history
CS-CURVE_SCRVUSD-005.DepositLimitModule.1
  • Loading branch information
AlbertoCentonze committed Oct 28, 2024
1 parent 9d904c0 commit 01b3077
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions contracts/DepositLimitModule.vy
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,15 @@ def available_deposit_limit(receiver: address) -> uint256:
@return uint256 Returns the maximum deposit limit if deposits are not paused,
otherwise returns (self.max_deposit_limit - vault_balance).
"""
max_deposit_limit: uint256 = self.max_deposit_limit

if self.deposits_paused:
return 0
if self.max_deposit_limit == max_value(uint256):
if max_deposit_limit == max_value(uint256):
return max_value(uint256)
else:
vault_balance: uint256 = staticcall vault.totalAssets()
if vault_balance >= self.max_deposit_limit:
if vault_balance >= max_deposit_limit:
return 0
else:
return self.max_deposit_limit - vault_balance
return max_deposit_limit - vault_balance

0 comments on commit 01b3077

Please sign in to comment.