Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: removed unnecessary array #11

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions contracts/main/CurveTwocryptoOptimized.vy
Original file line number Diff line number Diff line change
Expand Up @@ -1250,13 +1250,11 @@ def _fee(xp: uint256[N_COINS]) -> uint256:
@internal
@pure
def get_xcp(D: uint256, price_scale: uint256) -> uint256:
return isqrt(
unsafe_div(D, N_COINS) * # <------------- xp[0]
D * PRECISION / (price_scale * N_COINS) # xp[1]
) # <------------------------------- Geometric mean

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

return isqrt(x[0] * x[1]) # <------------------- Geometric Mean.


@view
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ pandas
matplotlib

# vyper and dev framework:
git+https://github.com/vyperlang/titanoboa@87593bb5c4d02bb8eaf4cc93e0e940ebf9a37900
git+https://github.com/vyperlang/titanoboa@8c2f673c10439d13b976d1f1667462810379f010
vyper>=0.3.10
1 change: 0 additions & 1 deletion tests/unitary/math/test_newton_D.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from decimal import Decimal

import pytest
from boa.vyper.contract import BoaError
from hypothesis import given, settings
from hypothesis import strategies as st

Expand Down
2 changes: 1 addition & 1 deletion tests/unitary/math/test_newton_D_ref.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from decimal import Decimal

import pytest
from boa.vyper.contract import BoaError
from boa import BoaError
from hypothesis import given, settings
from hypothesis import strategies as st

Expand Down
Loading