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

refactor: events must emit addresses involved in the operation for better dApp indexing #186

Closed 0xneves closed 7 months ago

0xneves commented 7 months ago

Refactor Request

Describe the Refactor Request

We need more context in the logs because we won't have a backend managing past history in the v1.0.0. This means when your wallet is connected to the dApp, we will check for indexed events in your address. We can fetch the swapId from such events, even the arguments used to call the function - for instance the createSwap bidding and asked assets. This is thanks to function handlers from SubGraph. However we need to know which user is part of which swap.

Describe Preferred Solution

  event SwapCreated(uint256 indexed swapId, address indexed owner, address indexed allowed);
  event SwapAccepted(uint256 indexed swapId, address indexed owner, address indexed allowed);
  event SwapCanceled(uint256 indexed swapId, address indexed owner);

Related Code

Current events are the following...

event SwapCreated(uint256 indexed swapId);
event SwapAccepted(uint256 indexed swapId, address indexed accepted);
event SwapCanceled(uint256 indexed swapId);

Additional Context

This is a hot task, the first PR resolving the issue will receive its bonuses.

blackbeard002 commented 7 months ago

Hey @0xneves I'm on it

blackbeard002 commented 7 months ago

Hey @0xneves ready for review

0xjoaovpsantos commented 7 months ago

Hey @0xneves, I made a PR too: https://github.com/blockful-io/swaplace-contracts/pull/188