Skip to content

Commit

Permalink
remove call to reduction coefficient
Browse files Browse the repository at this point in the history
  • Loading branch information
bout3fiddy committed Nov 22, 2023
1 parent 6d80da0 commit ba1dc63
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions contracts/main/CurveCryptoViews2Optimized.vy
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ interface Math:
D: uint256,
i: uint256,
) -> uint256: view
def reduction_coefficient(
x: uint256[N_COINS], fee_gamma: uint256
) -> uint256: view


N_COINS: constant(uint256) = 2
Expand Down Expand Up @@ -360,10 +357,15 @@ def _calc_withdraw_one_coin(
@internal
@view
def _fee(xp: uint256[N_COINS], swap: address) -> uint256:
math: Math = Curve(swap).MATH()

packed_fee_params: uint256 = Curve(swap).packed_fee_params()
fee_params: uint256[3] = self._unpack(packed_fee_params)
f: uint256 = math.reduction_coefficient(xp, fee_params[2])
f: uint256 = xp[0] + xp[1]
f = fee_params[2] * 10**18 / (
fee_params[2] + 10**18 -
(10**18 * N_COINS**N_COINS) * xp[0] / f * xp[1] / f
)

return (fee_params[0] * f + fee_params[1] * (10**18 - f)) / 10**18


Expand Down

0 comments on commit ba1dc63

Please sign in to comment.