Skip to content

Commit

Permalink
test: paypool, mkusd
Browse files Browse the repository at this point in the history
  • Loading branch information
Macket committed Feb 23, 2024
1 parent 3ba738e commit 72c1589
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 45 deletions.
26 changes: 26 additions & 0 deletions contracts/pools/mkusd/pooldata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"base_pool": "paypool",
"pool_types": ["meta", "factory"],
"lp_contract": "CurveTokenV2",
"swap_address": "0x9e10f9fb6f0d32b350cee2618662243d4f24c64a",
"lp_token_address": "0x9e10f9fb6f0d32b350cee2618662243d4f24c64a",
"zap_address": "0xE07a16358aA878CBDa2D49A88E5106871E0db307",
"gauge_addresses": ["0x088a9770bc30627791f42b551d474e8fd44808a2"],
"lp_constructor": {
"symbol": "mkUSDPay",
"name": "Curve.fi mkUSD/Paypool"
},
"coins": [
{
"name": "mkUSD",
"decimals": 18,
"underlying_address": "0x4591dbff62656e7859afe5e45f6f47d3669fbb28"
},
{
"name": "PYUSDUSDC",
"decimals": 18,
"base_pool_token": true,
"underlying_address": "0x383e6b4437b59fff47b619cba855ca29342a8559"
}
]
}
23 changes: 23 additions & 0 deletions contracts/pools/paypool/pooldata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"lp_contract": "CurveTokenV3",
"swap_address": "0x383e6b4437b59fff47b619cba855ca29342a8559",
"lp_token_address": "0x383e6b4437b59fff47b619cba855ca29342a8559",
"gauge_addresses": ["0x9da75997624c697444958aded6790bfca96af19a"],
"lp_constructor": {
"name": "PayPool",
"symbol": "PayPool"
},
"coins": [
{
"name": "PYUSD",
"decimals": 6,
"underlying_address": "0x6c3ea9036406852006290770bedfcaba0e23a0e8"
},
{
"name": "USDC",
"decimals": 6,
"underlying_address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"

}
]
}
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

POOLS = ['3pool', 'aave', 'aeth', 'bbtc', 'busd', 'compound', 'dusd', 'gusd', 'hbtc', 'husd', 'ib', 'link', 'musd', 'obtc',
'pax', 'pbtc', 'ren', 'reth', 'rsv', 'saave', 'sbtc', 'seth', 'steth', 'susd', 'tbtc', 'usdk', 'usdp', 'usdt',
'ust', 'y', 'tricrypto2', 'eurt', 'eurtusd', 'crveth', 'cvxeth', 'tusd', 'veth', 'usdv'] # 'eurs'
'ust', 'y', 'tricrypto2', 'eurt', 'eurtusd', 'crveth', 'cvxeth', 'tusd', 'veth', 'usdv', 'paypool', 'mkusd'] # 'eurs'

LENDING_POOLS = ['compound', 'usdt', 'y', 'busd', 'pax', 'aave', 'saave', 'ib']
META_POOLS = ['gusd', 'husd', 'usdk', 'musd', 'rsv', 'tbtc', 'dusd', 'pbtc', 'bbtc', 'obtc', 'ust', 'usdp', 'eurtusd', 'usdv']
META_POOLS = ['gusd', 'husd', 'usdk', 'musd', 'rsv', 'tbtc', 'dusd', 'pbtc', 'bbtc', 'obtc', 'ust', 'usdp', 'eurtusd', 'usdv', 'mkusd']
FACTORY_POOOLS = ['tusd'] # 'frax', 'lusd', 'busdv2', 'alusd', 'mim'
WETH_POOLS = ['tricrypto2', 'crveth', 'cvxeth']

Expand Down
9 changes: 7 additions & 2 deletions tests/fixtures/pooldata.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,13 @@ def factory_pool_address(pool_data):


@pytest.fixture(scope="module")
def is_plain_stable_ng(pool_data):
if pool_data['swap_address'] == "0x6685fcfce05e7502bf9f0aa03b36025b09374726": # vETH/ETH
def use_dynarray(pool_data):
ng_pools = [
"0x6685fcfce05e7502bf9f0aa03b36025b09374726", # vETH/ETH
"0x383e6b4437b59fff47b619cba855ca29342a8559", # PayPool
"0x9e10f9fb6f0d32b350cee2618662243d4f24c64a", # mkUSD
]
if pool_data['swap_address'] in ng_pools:
return True

return False
40 changes: 20 additions & 20 deletions tests/test_underlying.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
def test_balance(
zap, margo, deposit_address, token_address, gauge_address, n_coins_underlying,
underlying_coin_addresses, underlying_amounts, value_underlying, gauge, use_underlying,
is_plain_stable_ng, factory_pool_address
use_dynarray, factory_pool_address
):
assert gauge.balanceOf(margo.address) == 0

Expand All @@ -20,7 +20,7 @@ def test_balance(
underlying_amounts,
0,
use_underlying,
is_plain_stable_ng,
use_dynarray,
factory_pool_address,
{'from': margo, 'value': value_underlying}
)
Expand All @@ -31,7 +31,7 @@ def test_balance(

def test_approve(
zap, margo, deposit_address, token_address, gauge_address, n_coins_underlying, underlying_coin_addresses,
underlying_amounts, value_underlying, underlying_coins, lp_token, use_underlying, is_plain_stable_ng,
underlying_amounts, value_underlying, underlying_coins, lp_token, use_underlying, use_dynarray,
factory_pool_address
):
for coin in underlying_coins:
Expand All @@ -50,7 +50,7 @@ def test_approve(
underlying_amounts,
0,
use_underlying,
is_plain_stable_ng,
use_dynarray,
factory_pool_address,
{'from': margo, 'value': value_underlying}
)
Expand All @@ -66,7 +66,7 @@ def test_approve(
def test_token_mismatch(
zap, margo, deposit_address, other_token_address, gauge_address, n_coins_underlying,
underlying_coin_addresses, underlying_amounts, value_underlying, use_underlying,
is_plain_stable_ng, factory_pool_address
use_dynarray, factory_pool_address
):
with brownie.reverts():
zap.deposit_and_stake(
Expand All @@ -78,7 +78,7 @@ def test_token_mismatch(
underlying_amounts,
0,
use_underlying,
is_plain_stable_ng,
use_dynarray,
factory_pool_address,
{'from': margo, 'value': value_underlying}
)
Expand All @@ -87,7 +87,7 @@ def test_token_mismatch(
def test_gauge_mismatch(
zap, margo, deposit_address, token_address, other_gauge_address, n_coins_underlying,
underlying_coin_addresses, underlying_amounts, value_underlying, use_underlying,
is_plain_stable_ng, factory_pool_address
use_dynarray, factory_pool_address
):
with brownie.reverts():
zap.deposit_and_stake(
Expand All @@ -99,7 +99,7 @@ def test_gauge_mismatch(
underlying_amounts,
0,
use_underlying,
is_plain_stable_ng,
use_dynarray,
factory_pool_address,
{'from': margo, 'value': value_underlying}
)
Expand All @@ -108,7 +108,7 @@ def test_gauge_mismatch(
def test_n_coins_too_high(
zap, margo, deposit_address, token_address, gauge_address, n_coins_underlying,
underlying_coin_addresses, underlying_amounts, value_underlying, use_underlying,
is_plain_stable_ng, factory_pool_address
use_dynarray, factory_pool_address
):
with brownie.reverts():
zap.deposit_and_stake(
Expand All @@ -120,7 +120,7 @@ def test_n_coins_too_high(
underlying_amounts,
0,
use_underlying,
is_plain_stable_ng,
use_dynarray,
factory_pool_address,
{'from': margo, 'value': value_underlying}
)
Expand All @@ -129,7 +129,7 @@ def test_n_coins_too_high(
def test_n_coins_too_low(
zap, margo, deposit_address, token_address, gauge_address, n_coins_underlying,
underlying_coin_addresses, underlying_amounts, value_underlying, use_underlying,
is_plain_stable_ng, factory_pool_address
use_dynarray, factory_pool_address
):
with brownie.reverts():
zap.deposit_and_stake(
Expand All @@ -141,7 +141,7 @@ def test_n_coins_too_low(
underlying_amounts,
0,
use_underlying,
is_plain_stable_ng,
use_dynarray,
factory_pool_address,
{'from': margo, 'value': value_underlying}
)
Expand All @@ -150,7 +150,7 @@ def test_n_coins_too_low(
def test_wrong_coins(
zap, margo, deposit_address, token_address, gauge_address, n_coins_underlying,
wrong_coin_addresses, underlying_amounts, value_underlying, use_underlying,
is_plain_stable_ng, factory_pool_address
use_dynarray, factory_pool_address
):
with brownie.reverts():
zap.deposit_and_stake(
Expand All @@ -162,7 +162,7 @@ def test_wrong_coins(
underlying_amounts,
0,
use_underlying,
is_plain_stable_ng,
use_dynarray,
factory_pool_address,
{'from': margo, 'value': value_underlying}
)
Expand All @@ -171,7 +171,7 @@ def test_wrong_coins(
def test_wrong_order_of_coins(
zap, margo, deposit_address, token_address, gauge_address, n_coins_underlying,
underlying_coin_addresses_wrong_order, underlying_amounts, value_underlying,
use_underlying, is_plain_stable_ng, factory_pool_address
use_underlying, use_dynarray, factory_pool_address
):
with brownie.reverts():
zap.deposit_and_stake(
Expand All @@ -183,7 +183,7 @@ def test_wrong_order_of_coins(
underlying_amounts,
0,
use_underlying,
is_plain_stable_ng,
use_dynarray,
factory_pool_address,
{'from': margo, 'value': value_underlying}
)
Expand All @@ -192,7 +192,7 @@ def test_wrong_order_of_coins(
def test_wrong_value(
zap, margo, deposit_address, token_address, gauge_address, n_coins_underlying,
underlying_coin_addresses, underlying_amounts, value_underlying, use_underlying,
is_plain_stable_ng, factory_pool_address
use_dynarray, factory_pool_address
):
with brownie.reverts():
zap.deposit_and_stake(
Expand All @@ -204,7 +204,7 @@ def test_wrong_value(
underlying_amounts,
0,
use_underlying,
is_plain_stable_ng,
use_dynarray,
factory_pool_address,
{'from': margo, 'value': 0 if value_underlying > 0 else 10**18}
)
Expand All @@ -213,7 +213,7 @@ def test_wrong_value(
def test_wrong_use_underlying(
zap, margo, deposit_address, token_address, gauge_address, n_coins_underlying,
underlying_coin_addresses, underlying_amounts, value_underlying, use_underlying,
is_plain_stable_ng, factory_pool_address
use_dynarray, factory_pool_address
):
if factory_pool_address == brownie.ZERO_ADDRESS:
with brownie.reverts():
Expand All @@ -226,7 +226,7 @@ def test_wrong_use_underlying(
underlying_amounts,
0,
not use_underlying,
is_plain_stable_ng,
use_dynarray,
factory_pool_address,
{'from': margo, 'value': value_underlying}
)
Loading

0 comments on commit 72c1589

Please sign in to comment.