Skip to content

Commit 0b06d9e

Browse files
committed
Use in test
1 parent d110681 commit 0b06d9e

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

tests/pools/common/unitary/test_remove_liquidity_one_coin.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import brownie
22
import pytest
3+
from simulation import Curve
34

45
pytestmark = [
56
pytest.mark.skip_pool("busd", "compound", "pax", "susd", "usdt", "y"),
@@ -29,20 +30,23 @@ def test_amount_received(chain, alice, swap, wrapped_coins, wrapped_decimals, id
2930
else:
3031
assert 10**decimals // rate_mod <= wrapped.balanceOf(alice) <= 10**decimals
3132

32-
3333
@pytest.mark.itercoins("idx")
3434
@pytest.mark.parametrize("divisor", [1, 5, 42])
35-
def test_lp_token_balance(alice, swap, pool_token, idx, divisor, n_coins, base_amount):
35+
def test_lp_token_balance(alice, swap, wrapped_coins, pool_token, idx, divisor, n_coins, base_amount):
3636
amount = pool_token.balanceOf(alice) // divisor
3737

3838
swap.remove_liquidity_one_coin(amount, idx, 0, {'from': alice})
3939

4040
assert pool_token.balanceOf(alice) == n_coins * 10**18 * base_amount - amount
4141

42+
balances = [swap.balances(i) for i in range(n_coins)]
43+
curve_model = Curve(swap.A(), balances, n_coins, tokens=pool_token.totalSupply())
44+
assert wrapped_coins[idx].balanceOf(alice) == curve_model.calc_withdraw_one_coin(amount, idx)[0]
45+
4246

4347
@pytest.mark.itercoins("idx")
4448
@pytest.mark.parametrize("rate_mod", [0.9, 1.1])
45-
def test_expected_vs_actual(chain, alice, swap, wrapped_coins, pool_token, idx, rate_mod):
49+
def test_expected_vs_actual(chain, alice, swap, wrapped_coins, pool_token, idx, n_coins, rate_mod):
4650
amount = pool_token.balanceOf(alice) // 10
4751
wrapped = wrapped_coins[idx]
4852

@@ -57,6 +61,10 @@ def test_expected_vs_actual(chain, alice, swap, wrapped_coins, pool_token, idx,
5761

5862
assert wrapped_coins[idx].balanceOf(alice) == expected
5963

64+
balances = [swap.balances(i) for i in range(n_coins)]
65+
curve_model = Curve(swap.A(), balances, n_coins, tokens=pool_token.totalSupply())
66+
assert wrapped_coins[idx].balanceOf(alice) == curve_model.calc_withdraw_one_coin(amount, idx)[0]
67+
6068

6169
@pytest.mark.itercoins("idx")
6270
def test_below_min_amount(alice, swap, wrapped_coins, pool_token, idx):

0 commit comments

Comments
 (0)