Skip to content

Commit 101b154

Browse files
committed
added negative test for withdrawSurplus
1 parent 4d24a83 commit 101b154

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

packages/ethereum-contracts/test/foundry/superfluid/yieldbackend/YieldBackendUnitTestBase.sol

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,14 @@ abstract contract YieldBackendUnitTestBase is Test {
235235
assertGt(receiverBalanceAfter, receiverBalanceBefore, "surplus receiver balance should increase");
236236
}
237237

238+
/// @notice Test withdrawSurplus() direct call fails - assert: reverts when called directly (not via delegatecall)
239+
function testWithdrawSurplusDirectCallFails() public {
240+
// Attempt to call withdrawSurplus directly on backend (not via delegatecall)
241+
// This should fail because address(this) in backend context is the backend itself, not a SuperToken
242+
vm.expectRevert();
243+
IYieldBackend(address(backend)).withdrawSurplus(0);
244+
}
245+
238246
// ============ Internal helper functions ============
239247

240248
/// @notice Bound amount to reasonable range based on asset decimals

0 commit comments

Comments
 (0)