blockful-io / swaplace-contracts

Swaplace is an open-source, ownerless and feeless token swap protocol
https://app.swaplace.xyz/
MIT License
33 stars 33 forks source link

feat: add `onlyOwner` modifier and library #161

Closed luislucena16 closed 8 months ago

luislucena16 commented 8 months ago

remove this:

if (swap.owner != msg.sender) revert InvalidAddress(msg.sender);

using this:

function createSwap(
        Swap calldata swap
    ) public onlyOwner returns (uint256) {}

and improve the logic of the owner related function!

@0xneves please assign this to me!

0xneves commented 8 months ago

@luislucena16

The onlyOwner modifier is standard when dealing with ownership over contracts. Although Swaplace is not meant to have owners or Ownership features.

The swap.owner exists because swaps can be built by anyone, but can only be created if the owner proves to be msg.sender.

Whereas using OnlyOwner is not meant to verify swap.owner, it would be better with a modifier such as OnlySender(swap.owner). Although this would create more complexity for legibility, and require more gas.

Closing this issue because it does not improve the overall contract.

luislucena16 commented 8 months ago

I understand! the owner's approach is different from what I thought, thanks for the clarification!