From 6bfb07120864ab8161a80db72a6b02a8924896e9 Mon Sep 17 00:00:00 2001 From: Alberto Date: Wed, 29 May 2024 17:20:05 +0200 Subject: [PATCH] perf: removed unnecessary array from getter --- contracts/main/CurveTwocryptoOptimized.vy | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/contracts/main/CurveTwocryptoOptimized.vy b/contracts/main/CurveTwocryptoOptimized.vy index 899c0159..83dbb6b7 100644 --- a/contracts/main/CurveTwocryptoOptimized.vy +++ b/contracts/main/CurveTwocryptoOptimized.vy @@ -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