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

docs: research gas and cost efficiency for event emission #121

Closed 0xneves closed 9 months ago

0xneves commented 9 months ago

When thinking of making it easier the life of the devs, who implement indexers throughout the event system easier, they might find it useful that we describe the entire trade in the logs... The most important to boost now, is with the addition of the allowed field into the event args. This way we can track who created an offer, and to whom.

Now imagine that the following function:

 emit SwapCreated(l_swapId, msg.sender, swap.expiry);

...carried the allowed field, the bidding and asking, so we could track the swaps without the need to request view calls to fill Indexes for their front-end to display the swap contents.

Proposal:

By understanding the unitary extra cost for each user in ETH, we could charge the user to facilitate the implementation side of the protocol, or we could optimize, reducing gas usage and user cost, in exchange for the implementation side dealing with extra layers that could lower user expirience.

0xjoaovpsantos commented 9 months ago

Hey @0xneves , I'll get this issue ok?

0xneves commented 9 months ago

Hey @0xjoaovpsantos I'm glad you are helping in this task!! Its starting to buzz as the dApp gets shape and our graph is all ready also.

Will help a lot 🙌

0xjoaovpsantos commented 9 months ago

I opened a PR :)

https://github.com/blockful-io/swaplace-contracts/pull/146