Skip to content

Commit c02d423

Browse files
feat: Revoke support for native currency
1 parent 1eedf5f commit c02d423

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/ATokenVaultRevenueSplitterOwner.sol

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ contract ATokenVaultRevenueSplitterOwner is Ownable {
6969
_transferOwnership(owner);
7070
}
7171

72+
receive() external payable {
73+
revert("NATIVE_CURRENCY_NOT_SUPPORTED");
74+
}
75+
7276
/**
7377
* @dev Transfers the ownership of the aToken vault to a new owner. Claims all fees and rewards prior to transfer,
7478
* to secure already accrued fees and rewards for the configured split recipients.

test/ATokenVaultRevenueSplitterOwner.t.sol

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,4 +502,21 @@ contract ATokenVaultRevenueSplitterOwnerTest is Test {
502502
// The remaining unsplit amount is capped to the be strictly less than the number of recipients
503503
assertLe(assetToSplit.balanceOf(address(revenueSplitterOwner)), recipients.length - 1);
504504
}
505+
506+
function test_receive_revertsUponNativeTransfer(address msgSender, uint256 amount) public {
507+
vm.assume(amount > 0);
508+
vm.assume(msgSender != address(revenueSplitterOwner));
509+
510+
assertEq(address(revenueSplitterOwner).balance, 0);
511+
512+
vm.deal(msgSender, amount);
513+
514+
bool transferSucceeded = false; // Avoid 'Return value of low-level calls not used' warning.
515+
516+
vm.prank(msgSender);
517+
vm.expectRevert("NATIVE_CURRENCY_NOT_SUPPORTED");
518+
(transferSucceeded, ) = address(revenueSplitterOwner).call{value: amount}("");
519+
520+
assertEq(address(revenueSplitterOwner).balance, 0);
521+
}
505522
}

0 commit comments

Comments
 (0)