Closed ethanfrey closed 3 years ago
It looks like four separated tests cases too me:
Testing all scenario in single test makes big blob which is difficult to follow, and in case of failure it is slightly more difficult to find a reason. Splitting test to test well defined path is often better (it is also just single responsibility rule mapped to the QA world).
Yes, 4 different tests make sense when you have this nice suite setup.
Full stack success tests (everyone is in cw4-group, so everyone can swap and provide liquidity)
Yes
Failure test where if tfi-pair is not in a group, noone can provide liquidity to it or trade (best way would be to initially make it belong to group, so it is possible to provide some initial liquidity to it, so it is clear it is not a reason)
tfi-pair doesn't have a group. the asset in it is a dso token and in a group. we can have it part of a group that has one member, that can fill liquidity. but all other users are not in the group and no one can do anything with it.
Failure test where if token itself is not in a group, noone can interact with it
I think this is already tested in dso-token code. you can improve those for sure.
Failure test where addresses from outside group cannot interact
Yes
Clarifying something about tokens. There are three tokens we want to test.
For the suite, I would imagine setting something up which is cw20 to cw20. It takes group_a: Option<Addr>
and group_b: Option<Addr>
. If they are none, instantiate a cw20-base for that side. If it is some, instantiate dso-token for that side.
I would make a different suite setup that is only cw20-cw20 so the interfaces match and just a slightly different setup.
The cases for me are:
"can swap" and "can provide liquidity" can both be tested, they have the same controls
In tests, create 4 contracts using multitest:
tfi-factory
generic AMM factorycw4-group
as a DSO placeholder (for testing)cw20-whitelist
contract that points to the abovecw4-group
tfi-factory
to createtfi-pair
that swaps between a native token and thiscw20-whitelist
tokenActions:
cw4-group
members cannot provide liquidity to thetfi-pair
.tfi-pair
to thecw4-group
"whitelist"cw4-group
members to add liquidity totfi-pair
and make a swapcw4-group
members cannot do a swap in either direction