Aperture-Finance / uniswap-v3-automation-sdk

Other
17 stars 8 forks source link

Add AMM enum to chain info and trigger payloads in preparation or PCS integration #189

Closed tommyzhao451 closed 5 months ago

tommyzhao451 commented 5 months ago

This PR only changes the following 4 files and the remainder changes are results of changes from these 4 files: src/chain.ts src/interfaces/interfaces.ts src/helper/payload/index.ts src/viem/payload.ts

This PR currently hardcodes AMM map accesses to be UNISWAP, but can be dynamically decided by index access type in followup PRs.

gnarlycow commented 5 months ago

Thanks, Tommy! I made some further changes:

  1. Split factoryOrPoolDeployer into factory and optional poolDeployer because we do actually need PancakeSwap's factory in addition to its pool deployer.
  2. Moved AMM info into a field called amms so we can specify that keys are AutomatedMarketMaker enums, and it is easier this way in case we need to add another AMM in the future.
  3. Renamed AMM enums to "UNISWAP_V3" and "PANCAKESWAP_V3" because we support v3 specifically at this time and in the future we might add UNISWAP_V4.
  4. Instead of creating a separate set of functions with "AMM" prefix, I just updated the existing functions. This will force clients of the sdk to update callsites when they upgrade to this new version "3.x.x", but I believe this is the better alternative as it helps us correctly migrate our entire codebase to the new interface; otherwise it's easy to overlook some callsites and situations might arise where we unintentionally call some functions with the default Uniswap param in the middle of an execution of a PancakeSwap transaction.
gnarlycow commented 5 months ago
  1. I also deleted three unused chain ids (Goerli, Arbitrum goerli, Celo). The first two were testnets; both chains have been shut down a couple weeks ago. We should adds support for Goerli's replacement, Sepolia, when we have time. The third one, Celo, was planned at some point as a supported chain but that plan has been dropped and we don't intend to add support for it in the foreseeable future.