Skip to content

Commit

Permalink
Fixes #172:delegating security checks to the implementer
Browse files Browse the repository at this point in the history
  • Loading branch information
blackbeard002 committed Jan 16, 2024
1 parent b7f6603 commit f96cf99
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
9 changes: 1 addition & 8 deletions contracts/Swaplace.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,6 @@ contract Swaplace is SwapFactory, ISwaplace, IERC165 {
function createSwap(Swap calldata swap) public returns (uint256) {
if (swap.owner != msg.sender) revert InvalidAddress(msg.sender);

(address allowed, uint256 expiry) = parseData(swap.config);

if (expiry < block.timestamp) revert InvalidExpiry(expiry);

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

unchecked {
assembly {
sstore(_totalSwaps.slot, add(sload(_totalSwaps.slot), 1))
Expand All @@ -43,7 +36,7 @@ contract Swaplace is SwapFactory, ISwaplace, IERC165 {

_swaps[swapId] = swap;

emit SwapCreated(swapId, msg.sender, allowed, expiry);
emit SwapCreated(swapId);

return swapId;
}
Expand Down
5 changes: 1 addition & 4 deletions contracts/interfaces/ISwaplace.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ interface ISwaplace {
* @dev Emitted when a new Swap is created.
*/
event SwapCreated(
uint256 indexed swapId,
address indexed owner,
address indexed allowed,
uint256 expiry
uint256 indexed swapId
);

/**
Expand Down

0 comments on commit f96cf99

Please sign in to comment.