cowprotocol / cow-amm

An automated market maker running on top of CoW Protocol
17 stars 5 forks source link

feat: poller and simulate #83

Closed mfw78 closed 4 months ago

mfw78 commented 4 months ago

Description

A reference implementation that checks the veracity of signatures / orders generated from the ConstantProductHelper.

In order to use the poller:

cd utils
ETH_RPC_URL=<ETH_RPC_URL> AMM=<AMM> cargo run --bin cow-amm-poller

Where ETH_RPC_URL is the RPC's URL (chain_id is auto-detected) and AMM corresponds to a ConstantProduct AMM for which to generate an order.

At this point, the utility will perform a complete end-to-end test that will use simulateDelegateCall from the settlement contract, performing:

  1. Execute the interaction that was returned from the order function
  2. Call isValidSignature with the signature returned from the order function.

Success is indicated by an Ok() and the return data should be checked for the presence of isValidSignature(bytes32,bytes).selector.