Skip to content

Commit

Permalink
perf: removed unnecessary array from getter
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbertoCentonze committed May 29, 2024
1 parent 5d02dbf commit 6bfb071
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions contracts/main/CurveTwocryptoOptimized.vy
Original file line number Diff line number Diff line change
Expand Up @@ -1178,13 +1178,10 @@ def _fee(xp: uint256[N_COINS]) -> uint256:
@internal
@pure
def get_xcp(D: uint256, price_scale: uint256) -> uint256:

x: uint256[N_COINS] = [
unsafe_div(D, N_COINS),
D * PRECISION / (price_scale * N_COINS)
]

return isqrt(x[0] * x[1]) # <------------------- Geometric Mean.
return isqrt(
unsafe_div(D, N_COINS) * # <------------- xp[0]
D * PRECISION / (price_scale * N_COINS) # xp[1]
) # <------------------------------- Geometric mean


@view
Expand Down

0 comments on commit 6bfb071

Please sign in to comment.