Skip to content

Commit

Permalink
fix: fee was waaaayyyy too high
Browse files Browse the repository at this point in the history
  • Loading branch information
bout3fiddy committed Aug 6, 2023
1 parent 7eebe94 commit 8d1b609
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion contracts/main/CurveTricryptoOptimizedWETH.vy
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,7 @@ def _fee(xp: uint256[N_COINS]) -> uint256:

fee_params: uint256[3] = self._unpack(self.packed_fee_params)

if self.future_A_gamma_time < block.timestamp:
if self.future_A_gamma_time > block.timestamp: # TODO: do not charge max fee else pool rekt!
fee_params[0] = MAX_FEE # mid_fee is MAX_FEE during ramping
fee_params[1] = MAX_FEE # out_fee is MAX_FEE during ramping

Expand Down
5 changes: 1 addition & 4 deletions tests/boa/unitary/pool/stateful/stateful_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ def setup(self, user_id=0):
self.total_supply = self.token.balanceOf(user)

def get_coin_balance(self, user, coin):
if coin.symbol() == "WETH":
return boa.env.get_balance(user)
return coin.balanceOf(user)

def convert_amounts(self, amounts):
Expand Down Expand Up @@ -163,7 +161,7 @@ def _exchange(
with boa.env.prank(user):
self.coins[exchange_i].approve(self.swap, 2**256 - 1)
out = self.swap.exchange(
exchange_i, exchange_j, exchange_amount_in, 0
exchange_i, exchange_j, exchange_amount_in, calc_amount
)
except Exception:

Expand All @@ -179,7 +177,6 @@ def _exchange(
and self.check_limits(_amounts)
):
raise

return None

# This is to check that we didn't end up in a borked state after
Expand Down
1 change: 0 additions & 1 deletion tests/boa/unitary/pool/stateful/test_simulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ def exchange(self, exchange_amount_in, exchange_i, exchange_j, user):
if self.swap_out:

dy_trader = self.trader.buy(dx, exchange_i, exchange_j)

self.trader.tweak_price(boa.env.vm.state.timestamp)

# check if output value from exchange is similar:
Expand Down
8 changes: 4 additions & 4 deletions tests/boa/unitary/pool/test_deposit_withdraw.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def test_1st_deposit_and_last_withdraw(swap, coins, user, fee_receiver):
with boa.env.prank(user):
swap.add_liquidity(quantities, 0)

# test if eth was deposited:
assert boa.env.get_balance(swap.address) == bal_before + quantities[2]
# test if eth wasnt deposited:
assert boa.env.get_balance(swap.address) == bal_before

token_balance = swap.balanceOf(user)
assert (
Expand Down Expand Up @@ -79,8 +79,8 @@ def test_first_deposit_full_withdraw_second_deposit(
assert swap.xcp_profit() >= 10**18
assert swap.virtual_price() >= 10**18

# test if eth was deposited:
assert boa.env.get_balance(swap.address) == quantities[2] + eth_bal_before
# test if eth was not deposited:
assert boa.env.get_balance(swap.address) == eth_bal_before

for i in range(len(coins)):
assert swap.balances(i) == quantities[i] + swap_balances_before[i]
Expand Down

0 comments on commit 8d1b609

Please sign in to comment.