Skip to content

Commit

Permalink
use min max to cap instead of asserts
Browse files Browse the repository at this point in the history
  • Loading branch information
bout3fiddy committed Nov 8, 2023
1 parent 5d643a6 commit bdab80a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions contracts/main/CurveStableSwapNGAOracle.vy
Original file line number Diff line number Diff line change
Expand Up @@ -1170,11 +1170,8 @@ def _A() -> uint256:
uint256
)

assert fetched_A <= A_PRECISION * MAX_A # dev: fetched A is too high
assert fetched_A >= A_PRECISION # dev: fetched A is too low

return fetched_A

# Cap fetched_A between: [A_PRECISION, A_PRECISION * MAX_A]:
return min(max(A_PRECISION, fetched_A), A_PRECISION * MAX_A)


@pure
Expand Down

0 comments on commit bdab80a

Please sign in to comment.