Skip to content

Commit

Permalink
🐛 Fix: remove duplicate if condition
Browse files Browse the repository at this point in the history
  • Loading branch information
luislucena16 committed Dec 21, 2023
1 parent 3a7d5f1 commit 2c5707b
Showing 1 changed file with 21 additions and 26 deletions.
47 changes: 21 additions & 26 deletions contracts/SwapFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,34 +33,29 @@ import {ISwapFactory} from "./interfaces/ISwapFactory.sol";
* on-chain execution and trade on Swaplace.
*/
abstract contract SwapFactory is ISwapFactory, ISwap, IErrors {
/**
* @dev See {ISwapFactory-makeAsset}.
*/
function makeAsset(
address addr,
uint256 amountOrId
) public pure virtual returns (Asset memory) {
return Asset(addr, amountOrId);
}

/**
* @dev See {ISwapFactory-makeSwap}.
*/
function makeSwap(
address owner,
address allowed,
uint256 expiry,
Asset[] memory biding,
Asset[] memory asking
) public view virtual returns (Swap memory) {
if (expiry < block.timestamp) revert InvalidExpiry(expiry);
/**
* @dev See {ISwapFactory-makeAsset}.
*/
function makeAsset(
address addr,
uint256 amountOrId
) public pure virtual returns (Asset memory) {
return Asset(addr, amountOrId);
}

if (biding.length == 0 || asking.length == 0)
revert InvalidAssetsLength();
/**
* @dev See {ISwapFactory-makeSwap}.
*/
function makeSwap(
address owner,
address allowed,
uint256 expiry,
Asset[] memory biding,
Asset[] memory asking
) public view virtual returns (Swap memory) {
if (expiry < block.timestamp) revert InvalidExpiry(expiry);

if (biding.length == 0 || asking.length == 0) {
revert InvalidAssetsLength();
}
if (biding.length == 0 || asking.length == 0) revert InvalidAssetsLength();

return Swap(owner, allowed, expiry, biding, asking);
}
Expand Down

0 comments on commit 2c5707b

Please sign in to comment.