cowprotocol / cow-amm

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

Forked test showcasing the use of the helper interface #92

Closed fedgiac closed 4 months ago

fedgiac commented 4 months ago

This PR adds a minimal test showing how the helper contract can be used to generate valid AMM orders.

The helper contract hardcodes the contracts used in the various chains, so I have no choice but using a forked test.

I used the legacy path because there's no real CoW AMM with meaningful funds that isn't legacy.

Note that this test won't work once we migrated funds from the AMM used in the test. This doesn't matter as this test will have lost its utility at that point.

How to test

CI (but note that forked tests with the chosen endpoint are very unreliable, about 1 out of 10 runs have some network error). Look at the code to determine that we test everything we want from the interface.

wei3erHase commented 4 months ago

isn't tradedAmountToken0 unused in GetTradeableOrder lib?

fedgiac commented 4 months ago

The test is working as expected. The discussion on more precise checks on the amounts is still open, but I don't see it as a blocker for merging. Feel free to continue the discussion here.