✧ ISwaplace
Interface of the {Swaplace} implementation.
SwapCreated
event SwapCreated(uint256 swapId, address owner, address allowed)Emitted when a new Swap is created.
SwapAccepted
event SwapAccepted(uint256 swapId, address owner, address allowed)Emitted when a Swap is accepted.
SwapCanceled
event SwapCanceled(uint256 swapId, address owner)Emitted when a Swap is canceled.
createSwap
function createSwap(struct ISwap.Swap Swap) external payable returns (uint256)Requirements:
Allow users to create a Swap. Each new Swap self-increments its ID by one.
ownermust be the caller's address.expiryshould be bigger than the timestamp.bidingandaskingmust not be empty.
Emits a {SwapCreated} event.
acceptSwap
Accepts a Swap. Once the Swap is accepted, the expiry is set to zero to avoid reutilization.
Requirements:
allowedmust be the zero address or match the caller's address.expirymust be bigger than the timestamp.bidingassets must be allowed to transfer.askingassets must be allowed to transfer.
Emits a {SwapAccepted} event.
cancelSwap
Cancels an active Swap by setting the expiry to zero.
Expiry with 0 seconds means that the Swap doesn't exist or is already canceled.
Requirements:
ownermust be the caller's address.expirymust be bigger than the timestamp.
Emits a {SwapCanceled} event.
getSwap
Retrieves the details of a Swap based on the swapId provided.
Last updated