marigold-dev / batcher

The aim of the batch clearing dex is to enable users to deposit tokens with the aim of being swapped at a fair price with bounded slippage and almost no impermanent loss.
https://batcher.marigold.dev/
MIT License
10 stars 2 forks source link

Further split out batcher and mm contracts to avoid size constraint #410

Open glottologist opened 1 year ago

glottologist commented 1 year ago

With all the additional support required for the market maker the batcher contract has broken the size constraint for origination. So we need to explore ways to break it down into smaller contracts.

There are a few possibilities:

  1. Pull all the token storage and methods out into a separate contract that can be called by noth batcher and mm.
  2. Additionally we can use a separate contract for each vault - this would remove the support required in batcher to 'tell' the market maker how much it expects on redemption (this is to keep the balances correct in each vault). If each vault were its own contract then it would have its own balances which would be clear on redemption from batcher (this would also be the case for fees)