Skip to content

Commit

Permalink
feat: rm zero address checks and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-manuel committed Jul 5, 2024
1 parent 74cec31 commit 8651824
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 15 deletions.
4 changes: 1 addition & 3 deletions src/PSM3.sol
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ contract PSM3 is IPSM3 {
function deposit(address asset, address receiver, uint256 assetsToDeposit)
external override returns (uint256 newShares)
{
require(receiver != address(0), "PSM3/invalid-receiver");
require(assetsToDeposit != 0, "PSM3/invalid-amount");
require(assetsToDeposit != 0, "PSM3/invalid-amount");

newShares = previewDeposit(asset, assetsToDeposit);

Expand All @@ -122,7 +121,6 @@ contract PSM3 is IPSM3 {
function withdraw(address asset, address receiver, uint256 maxAssetsToWithdraw)
external override returns (uint256 assetsWithdrawn)
{
require(receiver != address(0), "PSM3/invalid-receiver");
require(maxAssetsToWithdraw != 0, "PSM3/invalid-amount");

uint256 sharesToBurn;
Expand Down
5 changes: 0 additions & 5 deletions test/unit/Deposit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ contract PSMDepositTests is PSMTestBase {
address receiver1 = makeAddr("receiver1");
address receiver2 = makeAddr("receiver2");

function test_deposit_zeroReceiver() public {
vm.expectRevert("PSM3/invalid-receiver");
psm.deposit(address(usdc), address(0), 100e6);
}

function test_deposit_zeroAmount() public {
vm.expectRevert("PSM3/invalid-amount");
psm.deposit(address(usdc), user1, 0);
Expand Down
7 changes: 0 additions & 7 deletions test/unit/Withdraw.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@ contract PSMWithdrawTests is PSMTestBase {
address receiver1 = makeAddr("receiver1");
address receiver2 = makeAddr("receiver2");

function test_withdraw_zeroReceiver() public {
_deposit(address(usdc), user1, 100e6);

vm.expectRevert("PSM3/invalid-receiver");
psm.withdraw(address(usdc), address(0), 100e6);
}

function test_withdraw_zeroAmount() public {
_deposit(address(usdc), user1, 100e6);

Expand Down

0 comments on commit 8651824

Please sign in to comment.