Skip to content

Commit

Permalink
refactor: Remove unecessary import and move the declarion of events s…
Browse files Browse the repository at this point in the history
…ignatures
  • Loading branch information
0xjoaovpsantos committed Dec 21, 2023
1 parent 94a2ef3 commit 4c42b68
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 21 deletions.
41 changes: 20 additions & 21 deletions contracts/Swaplace.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pragma solidity ^0.8.17;
import {IERC165} from "./interfaces/IERC165.sol";
import {ISwaplace} from "./interfaces/ISwaplace.sol";
import {ITransfer} from "./interfaces/ITransfer.sol";
import {ISwap} from "./interfaces/ISwap.sol";
import {SwapFactory} from "./SwapFactory.sol";

/**
Expand All @@ -18,26 +17,26 @@ contract Swaplace is SwapFactory, ISwaplace, IERC165 {
/// @dev Swap Identifier counter.
uint256 private _totalSwaps;

/**
* @dev Emitted when a new Swap is created.
* keccak-256(SwapCreated(uint256,address,uint256,address))
*/
bytes32 private constant EVENT_SWAP_CREATED_SIGNATURE =
0x43a58bfac3282e5ce3bfd714c5bc0ddff8d6f2cd049db0b02a25d7cdd5026efb;

/**
* @dev Emitted when a Swap is accepted.
* keccak-256(SwapAccepted(uint256,address))
*/
bytes32 private constant EVENT_SWAP_ACCEPTED_SIGNATURE =
0x38eced64b5c4ab50bb61d2f5fcace3c629a2d92f974374bf4a4f3e8a7c49caef;

/**
* @dev Emitted when a Swap is canceled.
* keccak-256(SwapCanceled(uint256,address))
*/
bytes32 private constant EVENT_SWAP_CANCELED_SIGNATURE =
0x0a01e988a96145b1dd49cafc687666a0525e6b929299df4652cc646915e696d8;
/**
* @dev Emitted when a new Swap is created.
* keccak-256(SwapCreated(uint256,address,uint256,address))
*/
bytes32 private constant EVENT_SWAP_CREATED_SIGNATURE =
0x43a58bfac3282e5ce3bfd714c5bc0ddff8d6f2cd049db0b02a25d7cdd5026efb;

/**
* @dev Emitted when a Swap is accepted.
* keccak-256(SwapAccepted(uint256,address))
*/
bytes32 private constant EVENT_SWAP_ACCEPTED_SIGNATURE =
0x38eced64b5c4ab50bb61d2f5fcace3c629a2d92f974374bf4a4f3e8a7c49caef;

/**
* @dev Emitted when a Swap is canceled.
* keccak-256(SwapCanceled(uint256,address))
*/
bytes32 private constant EVENT_SWAP_CANCELED_SIGNATURE =
0x0a01e988a96145b1dd49cafc687666a0525e6b929299df4652cc646915e696d8;

/// @dev Mapping of Swap ID to Swap struct. See {ISwap-Swap}.
mapping(uint256 => Swap) private _swaps;
Expand Down
15 changes: 15 additions & 0 deletions contracts/interfaces/ISwaplace.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {ISwap} from "./ISwap.sol";
* @dev Interface of the {Swaplace} implementation.
*/
interface ISwaplace {
<<<<<<< HEAD

/**
* @dev Allow users to create a Swap. Each new Swap self-increments its ID by one.
Expand Down Expand Up @@ -53,6 +54,20 @@ interface ISwaplace {
* Emits a {SwapCanceled} event.
*/
function cancelSwap(uint256 swapId) external;
=======
/**
* @dev Allow users to create a Swap. Each new Swap self-increments its id by one.
*
* Requirements:
*
* - `owner` must be the caller address.
* - `expiry` should be bigger than timestamp.
* - `biding` and `asking` must not be empty.
*
* Emits a {SwapCreated} event.
*/
function createSwap(ISwap.Swap calldata Swap) external returns (uint256);
>>>>>>> a7ca232 (refactor: Remove unecessary import and move the declarion of events signatures)

/**
* @dev Retrieves the details of a Swap based on the `swapId` provided.
Expand Down

0 comments on commit 4c42b68

Please sign in to comment.