Skip to content

Commit

Permalink
✨ fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
cmontecoding committed Dec 13, 2024
1 parent e9bcad0 commit 9bd965c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
3 changes: 2 additions & 1 deletion script/utils/parameters/BaseParameters.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ contract BaseParameters {

address public constant ZAP = 0x84f531d85fAA7Be42f8a248B87e40f760e558F7C;

address payable public constant PAY = payable(0xdFdDC95c4997f8CE09c412d53378E2101b400609);
address payable public constant PAY =
payable(0xdFdDC95c4997f8CE09c412d53378E2101b400609);

address public constant USDT = address(0);

Expand Down
4 changes: 2 additions & 2 deletions src/Engine.sol
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ contract Engine is
) {
if (
_perpsMarketProxy == address(0) || _spotMarketProxy == address(0)
|| _sUSDProxy == address(0) || _zap == address(0) || _pay == address(0)
|| _usdc == address(0) || _weth == address(0)
|| _sUSDProxy == address(0) || _zap == address(0)
|| _pay == address(0) || _usdc == address(0) || _weth == address(0)
) revert ZeroAddress();

PERPS_MARKET_PROXY = IPerpsMarketProxy(_perpsMarketProxy);
Expand Down
8 changes: 3 additions & 5 deletions src/utils/Pay.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {IWETH} from "src/interfaces/tokens/IWETH.sol";
/// @notice Pay contract for unwrapping WETH and sending it to a recipient
/// @author cmontecoding
contract Pay {

/// @notice WETH contract
IWETH public WETH;

Expand All @@ -20,15 +19,14 @@ contract Pay {
/// @notice unwrap WETH and send it to a recipient
/// @param amount amount of WETH to unwrap
/// @param to recipient address
function unwrapAndPay(uint amount, address to) public {
function unwrapAndPay(uint256 amount, address to) public {
WETH.transferFrom(msg.sender, address(this), amount);
WETH.withdraw(amount);
(bool success, ) = to.call{value: amount}("");
(bool success,) = to.call{value: amount}("");
if (success != true) {
revert ETHTransferFailed();
}
}

receive() external payable {}

}
}
10 changes: 4 additions & 6 deletions test/Pay.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {Pay} from "src/utils/Pay.sol";
import {IWETH} from "src/interfaces/tokens/IWETH.sol";

contract PayTest is Bootstrap {

Pay payLocal;
Pay payFork;
IWETH wethWrapped;
Expand All @@ -21,7 +20,7 @@ contract PayTest is Bootstrap {
}

function test_unwrapAndPay_local() public {
uint amount = 100;
uint256 amount = 100;
address to = address(1);
uint256 balanceBefore = to.balance;

Expand Down Expand Up @@ -50,7 +49,7 @@ contract PayTest is Bootstrap {
}

function test_unwrapAndPay_withMaliciousReceiver() public {
uint amount = 100;
uint256 amount = 100;
MaliciousReceiver maliciousReceiver = new MaliciousReceiver();
address to = address(maliciousReceiver);

Expand All @@ -65,7 +64,7 @@ contract PayTest is Bootstrap {
}

function test_unwrapAndPay_fork() public {
uint amount = 100;
uint256 amount = 100;
address to = address(1);
uint256 balanceBefore = to.balance;

Expand All @@ -92,7 +91,6 @@ contract PayTest is Bootstrap {
payFork.unwrapAndPay(amount, to);
assertEq(to.balance, balanceBefore + amount);
}

}

// Helper contract that rejects ETH transfers
Expand All @@ -108,4 +106,4 @@ contract MaliciousReceiver {
{
return 0x150b7a02;
}
}
}

0 comments on commit 9bd965c

Please sign in to comment.