Skip to content

Commit

Permalink
allow sweeping of base tokens (#913)
Browse files Browse the repository at this point in the history
* remove base balance restriction from sweep function

* update comments to reflect changes

* remove all instances of _totalBase

* fix tests

* add items to prettierignore and fix formatting

* add out/ to prettierignore

* extract baseToken tests

* add periods to comments
  • Loading branch information
mcclurejt authored Apr 8, 2024
1 parent 5fe02c3 commit f959d2b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
6 changes: 5 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@
*.js
*.md
*.yaml
lib/
lib/
target/
forge-cache/
node_modules/
out/
21 changes: 19 additions & 2 deletions test/instances/erc4626/Sweep.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ contract SweepTest is BaseTest, IHyperdriveEvents {
hyperdrive.sweep(IERC20(address(sweepable)));
}

function test_sweep_failure_direct_sweeps() external {
function test_sweep_failure_direct_vaultToken() external {
vm.stopPrank();
vm.startPrank(celine);

Expand All @@ -120,7 +120,7 @@ contract SweepTest is BaseTest, IHyperdriveEvents {
hyperdrive.sweep(IERC20(vaultToken));
}

function test_sweep_failure_indirect_sweeps() external {
function test_sweep_failure_indirect_vaultToken() external {
vm.stopPrank();
vm.startPrank(celine);

Expand All @@ -129,6 +129,23 @@ contract SweepTest is BaseTest, IHyperdriveEvents {
hyperdrive.sweep(IERC20(address(vaultForwarder)));
}

function test_sweep_success_direct_baseToken() external {
vm.stopPrank();
vm.startPrank(celine);

// Trying to sweep the base token should succeed since any lingering amount is a mistake.
address baseToken = address(hyperdrive.baseToken());
hyperdrive.sweep(IERC20(baseToken));
}

function test_sweep_success_indirect_baseToken() external {
vm.stopPrank();
vm.startPrank(celine);

// Trying to sweep the base token should succeed since any lingering amount is a mistake.
hyperdrive.sweep(IERC20(address(baseForwarder)));
}

function test_sweep_success_sweepCollector() external {
// The sweep collector can sweep a sweepable token.
vm.stopPrank();
Expand Down

0 comments on commit f959d2b

Please sign in to comment.