darkforestry / amms-rs

A Rust library to interact with automated market makers across EVM chains.
438 stars 117 forks source link

Implement Hash, Eq and PartialEq for `AMM` and `Factory` #187

Closed 0xDmtri closed 1 month ago

0xDmtri commented 2 months ago

Problem:

Now, enum AMM (and Factory) compare be compared nor inserted into a HashMap. This is a bit inconvenient.

Solution:

I offer to implement Hash, Eq and PartialEq for AMM and Factory macros. Moreover, I think it will be sufficient (to save up compute time) to just use Addresses for the comparison as they are unique Hashes a priori.

P.S. Feel free to suggest a better idea. Always open for discussion :)