Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add btt tests for finalize methods #159

Merged
merged 26 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
5321bbf
test: btt tests for bpool.swapExactAmountIn
0xteddybear Jul 9, 2024
432f63a
chore: delete preexisting unit tests
0xteddybear Jul 9, 2024
e66ed9f
test: small renames from feedback
0xteddybear Jul 10, 2024
1acff62
test: be explicit about untestable code
0xteddybear Jul 10, 2024
86f1950
chore: merge dev
0xteddybear Jul 11, 2024
d111e8b
test: adding skipped test for unreachable condition
0xteddybear Jul 11, 2024
9f074dc
test: code wasnt so unreachable after all
0xteddybear Jul 11, 2024
3f85e43
refactor: get rid of _setRecord
0xteddybear Jul 11, 2024
63b6058
test: btt tests for bcowpool.verify
0xteddybear Jul 11, 2024
1d3a30f
chore: delete preexisting unit tests
0xteddybear Jul 11, 2024
c9d196b
chore: testcase renaming from review
0xteddybear Jul 15, 2024
69f49e7
chore: get rid of _setTokens altogether
0xteddybear Jul 15, 2024
23c5a1b
test: fuzz all possible valid order.sellAmount values
0xteddybear Jul 15, 2024
a134e2c
chore: rename correctOrder -> validOrder
0xteddybear Jul 15, 2024
2668552
chore: merge dev
0xteddybear Jul 15, 2024
b5e712c
chore: merge dev
0xteddybear Jul 16, 2024
62d9d3a
test: btt tests for bpool.finalize
0xteddybear Jul 16, 2024
284322a
test: btt tests for bcowpool.finalize
0xteddybear Jul 16, 2024
31e634a
chore: remove preexisting unit tests replaced by ones in this pr
0xteddybear Jul 16, 2024
3bf22e8
fix: feedback from review
0xteddybear Jul 16, 2024
bd2342b
refactor: make caller==controller default scenario
0xteddybear Jul 16, 2024
d43db63
fix: reorganize .tree
0xteddybear Jul 17, 2024
8f5983a
fix: feedback from review
0xteddybear Jul 18, 2024
9c1a88a
chore: merge dev
0xteddybear Jul 22, 2024
35a1689
fix: feedback from review, calling internal method directly
0xteddybear Jul 22, 2024
6b86d48
chore: merge dev
0xteddybear Jul 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions test/unit/BCoWPool/BCoWPool.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {BCoWPoolBase} from './BCoWPoolBase.sol';
import {IBCoWFactory} from 'interfaces/IBCoWFactory.sol';
import {IBPool} from 'interfaces/IBPool.sol';

contract BCoWPoolFinalize is BCoWPoolBase {
contract BCoWPool_afterFinalize is BCoWPoolBase {
uint256 public tokenWeight = 1e18;

function setUp() public virtual override {
Expand All @@ -29,19 +29,19 @@ contract BCoWPoolFinalize is BCoWPoolBase {
vm.expectCall(tokens[1], abi.encodeCall(IERC20.approve, (vaultRelayer, type(uint256).max)));
// it calls logBCoWPool on the factory
vm.expectCall(address(this), abi.encodeCall(IBCoWFactory.logBCoWPool, ()));
bCoWPool.finalize();
bCoWPool.call__afterFinalize();
}

function test_WhenFactorysLogBCoWPoolDoesNotRevert() external {
// it returns
bCoWPool.finalize();
bCoWPool.call__afterFinalize();
}

function test_WhenFactorysLogBCoWPoolReverts(bytes memory revertData) external {
vm.mockCallRevert(address(this), abi.encodeCall(IBCoWFactory.logBCoWPool, ()), revertData);
// it emits a COWAMMPoolCreated event
vm.expectEmit(address(bCoWPool));
emit IBCoWFactory.COWAMMPoolCreated(address(bCoWPool));
bCoWPool.finalize();
bCoWPool.call__afterFinalize();
}
}
2 changes: 1 addition & 1 deletion test/unit/BCoWPool/BCoWPool.tree
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
BCoWPool::Finalize
BCoWPool::_afterFinalize
├── when called
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

much betta!

│ ├── it calls approve on every bound token
│ └── it calls logBCoWPool on the factory
Expand Down
Loading